Class: ReadXls::WorkbookBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/read_xls/workbook_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(biff) ⇒ WorkbookBuilder

Returns a new instance of WorkbookBuilder.



5
6
7
8
9
10
# File 'lib/read_xls/workbook_builder.rb', line 5

def initialize(biff)
  self.biff               = biff
  self.worksheet_builders = []
  self.formats            = default_formats
  self.extended_formats   = []
end

Instance Attribute Details

#biffObject

Returns the value of attribute biff.



3
4
5
# File 'lib/read_xls/workbook_builder.rb', line 3

def biff
  @biff
end

#extended_formatsObject

Returns the value of attribute extended_formats.



3
4
5
# File 'lib/read_xls/workbook_builder.rb', line 3

def extended_formats
  @extended_formats
end

#formatsObject

Returns the value of attribute formats.



3
4
5
# File 'lib/read_xls/workbook_builder.rb', line 3

def formats
  @formats
end

#sstObject

Returns the value of attribute sst.



3
4
5
# File 'lib/read_xls/workbook_builder.rb', line 3

def sst
  @sst
end

#worksheet_buildersObject

Returns the value of attribute worksheet_builders.



3
4
5
# File 'lib/read_xls/workbook_builder.rb', line 3

def worksheet_builders
  @worksheet_builders
end

Instance Method Details

#add_extended_format(extended_format) ⇒ Object



20
21
22
# File 'lib/read_xls/workbook_builder.rb', line 20

def add_extended_format(extended_format)
  self.extended_formats.push(extended_format)
end

#add_format(format_index, format_string) ⇒ Object



16
17
18
# File 'lib/read_xls/workbook_builder.rb', line 16

def add_format(format_index, format_string)
  self.formats[format_index] = format_string
end

#add_worksheet_builder(worksheet_builder) ⇒ Object



12
13
14
# File 'lib/read_xls/workbook_builder.rb', line 12

def add_worksheet_builder(worksheet_builder)
  self.worksheet_builders.push(worksheet_builder)
end

#buildObject



24
25
26
27
28
29
30
# File 'lib/read_xls/workbook_builder.rb', line 24

def build
  workbook                  = ::ReadXls::Workbook.new
  workbook.formats          = build_formats
  workbook.extended_formats = build_extended_formats
  workbook.worksheets       = build_worksheets
  workbook
end