Class: ReadXls::Workbook::WorksheetBuilder
- Inherits:
-
Object
- Object
- ReadXls::Workbook::WorksheetBuilder
- Defined in:
- lib/read_xls/workbook/worksheet_builder.rb
Instance Attribute Summary collapse
-
#extended_formats ⇒ Object
Returns the value of attribute extended_formats.
-
#formats ⇒ Object
Returns the value of attribute formats.
-
#formula_strings ⇒ Object
Returns the value of attribute formula_strings.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#sst ⇒ Object
Returns the value of attribute sst.
Instance Method Summary collapse
- #add_column_to_row(row_index, column_index, value) ⇒ Object
- #add_formula_string(string) ⇒ Object
- #add_row(row_index, row) ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ WorksheetBuilder
constructor
A new instance of WorksheetBuilder.
- #next_formula_string! ⇒ Object
Constructor Details
#initialize ⇒ WorksheetBuilder
Returns a new instance of WorksheetBuilder.
6 7 8 9 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 6 def initialize self.rows = [] self.formula_strings = [] end |
Instance Attribute Details
#extended_formats ⇒ Object
Returns the value of attribute extended_formats.
4 5 6 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 4 def extended_formats @extended_formats end |
#formats ⇒ Object
Returns the value of attribute formats.
4 5 6 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 4 def formats @formats end |
#formula_strings ⇒ Object
Returns the value of attribute formula_strings.
4 5 6 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 4 def formula_strings @formula_strings end |
#rows ⇒ Object
Returns the value of attribute rows.
4 5 6 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 4 def rows @rows end |
#sst ⇒ Object
Returns the value of attribute sst.
4 5 6 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 4 def sst @sst end |
Instance Method Details
#add_column_to_row(row_index, column_index, value) ⇒ Object
15 16 17 18 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 15 def add_column_to_row(row_index, column_index, value) row = rows[row_index] || raise("could not find row") row.add_column(column_index, value) end |
#add_formula_string(string) ⇒ Object
20 21 22 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 20 def add_formula_string(string) self.formula_strings.push(string) end |
#add_row(row_index, row) ⇒ Object
11 12 13 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 11 def add_row(row_index, row) rows[row_index] = row end |
#build ⇒ Object
24 25 26 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 24 def build ::ReadXls::Workbook::Worksheet.new(:rows => build_rows) end |
#next_formula_string! ⇒ Object
28 29 30 |
# File 'lib/read_xls/workbook/worksheet_builder.rb', line 28 def next_formula_string! self.formula_strings.shift end |