Module: POI
- Defined in:
- lib/poi/version.rb,
lib/poi/workbook.rb,
lib/poi/workbook/row.rb,
lib/poi/workbook/area.rb,
lib/poi/workbook/cell.rb,
lib/poi/workbook/workbook.rb,
lib/poi/workbook/worksheet.rb,
lib/poi/workbook/named_range.rb
Defined Under Namespace
Classes: Area, Cell, Cells, NamedRange, Row, Rows, Workbook, Worksheet, Worksheets
Constant Summary
collapse
- MAJOR =
1
- MINOR =
0
- PATCH_LEVEL =
0
- VERSION =
[MAJOR, MINOR, PATCH_LEVEL].join('.').freeze
- AREA_REF =
org.apache.poi.ss.util.AreaReference
- CELL_REF =
org.apache.poi.ss.util.CellReference
Class Method Summary
collapse
Class Method Details
.Facade(delegate, java_class) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/poi/workbook.rb', line 5
def self.Facade(delegate, java_class)
cls = Class.new
java_class.java_class.java_instance_methods.select{|e| e.public?}.each do | method |
args = method.arity.times.collect{|i| "arg#{i}"}.join(", ")
method_name = method.name.gsub(/([A-Z])/){|e| "_#{e.downcase}"}
code = "def #{method_name}(#{args}); #{delegate}.#{method.name}(#{args}); end"
if method_name =~ /^get_[a-z]/
alias_method_name = method_name.sub('get_', '')
code += "\nalias :#{alias_method_name} :#{method_name}"
if method.return_type.to_s == 'boolean'
code += "\nalias :#{alias_method_name}? :#{method_name}"
end
elsif method_name =~ /^set_[a-z]/ && method.arity == 1
alias_method_name = "#{method_name.sub('set_', '')}"
code += "\nalias :#{alias_method_name}= :#{method_name}"
if method.argument_types.first.to_s == 'boolean'
code += "\ndef #{alias_method_name}!; #{alias_method_name} = true; end"
end
elsif method.return_type.to_s == 'boolean' && method_name =~ /is_/
code += "\nalias :#{method_name.sub('is_', '')}? :#{method_name}"
elsif method.return_type.nil? && (method.argument_types.nil? || method.argument_types.empty?)
code += "\nalias :#{method_name}! :#{method_name}"
end
cls.class_eval(code, __FILE__, __LINE__)
end
cls
end
|
.version ⇒ Object
8
9
10
|
# File 'lib/poi/version.rb', line 8
def self.version
VERSION
end
|