Class: Smerp::Exporter::Excel::Workbook

Inherits:
Object
  • Object
show all
Defined in:
lib/smerp/exporter/excel/workbook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wb, config) ⇒ Workbook

Returns a new instance of Workbook.



11
12
13
14
15
# File 'lib/smerp/exporter/excel/workbook.rb', line 11

def initialize(wb, config)
  @inst = wb
  @config = config
  @wsRec = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mtd, *args, &block) ⇒ Object



36
37
38
# File 'lib/smerp/exporter/excel/workbook.rb', line 36

def method_missing(mtd, *args, &block)
  @inst.send(mtd, *args, &block)
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



10
11
12
# File 'lib/smerp/exporter/excel/workbook.rb', line 10

def config
  @config
end

#instObject (readonly)

Returns the value of attribute inst.



9
10
11
# File 'lib/smerp/exporter/excel/workbook.rb', line 9

def inst
  @inst
end

Instance Method Details

#worksheet(name, *args, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/smerp/exporter/excel/workbook.rb', line 17

def worksheet(name, *args, &block)
  ws = @inst.add_worksheet(name: name)
  wsProxy = Worksheet.new(ws, @config)
  @wsRec[name] = wsProxy

  if block
    block.call(wsProxy)
  else
    ws
  end
end