Class: Smerp::Exporter::Excel::Worksheet
- Inherits:
-
Object
- Object
- Smerp::Exporter::Excel::Worksheet
- Defined in:
- lib/smerp/exporter/excel/worksheet.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#inst ⇒ Object
readonly
Returns the value of attribute inst.
Instance Method Summary collapse
-
#initialize(ws, config) ⇒ Worksheet
constructor
A new instance of Worksheet.
- #insert_row(val = [], *args, &block) ⇒ Object
- #method_missing(mtd, *args, &block) ⇒ Object
- #start_col=(col) ⇒ Object
Constructor Details
#initialize(ws, config) ⇒ Worksheet
Returns a new instance of Worksheet.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 10 def initialize(ws, config) @inst = ws @config = config @curRow = 0 @curCol = 0 if @config.start_row != @curRow (0...@config.start_row-1).each do |i| @inst.add_row end end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mtd, *args, &block) ⇒ Object
37 38 39 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 37 def method_missing(mtd, *args, &block) @inst.send(mtd, *args, &block) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
9 10 11 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 9 def config @config end |
#inst ⇒ Object (readonly)
Returns the value of attribute inst.
8 9 10 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 8 def inst @inst end |
Instance Method Details
#insert_row(val = [], *args, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 28 def insert_row(val = [], *args, &block) if @config.start_col != 0 patch = Array.new(@config.start_col).collect { |e| "" } val = patch.concat(val) end @inst.add_row(val, *args) end |
#start_col=(col) ⇒ Object
24 25 26 |
# File 'lib/smerp/exporter/excel/worksheet.rb', line 24 def start_col=(col) @config.start_col = col end |