class ReadXls::Workbook::WorksheetBuilder

Attributes

extended_formats[RW]
formats[RW]
formula_strings[RW]
rows[RW]
sst[RW]

Public Class Methods

new() click to toggle source
# File lib/read_xls/workbook/worksheet_builder.rb, line 6
def initialize
  self.rows            = []
  self.formula_strings = []
end

Public Instance Methods

add_column_to_row(row_index, column_index, value) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/read_xls/workbook/worksheet_builder.rb, line 11
def add_row(row_index, row)
  rows[row_index] = row
end
build() click to toggle source
# File lib/read_xls/workbook/worksheet_builder.rb, line 24
def build
  ::ReadXls::Workbook::Worksheet.new(:rows => build_rows)
end
next_formula_string!() click to toggle source
# File lib/read_xls/workbook/worksheet_builder.rb, line 28
def next_formula_string!
  self.formula_strings.shift
end

Private Instance Methods

build_rows() click to toggle source
# File lib/read_xls/workbook/worksheet_builder.rb, line 35
def build_rows
  rows.each_with_index.each do |_, row_index|
    rows[row_index] ||= ::ReadXls::Evaluator::Row.new(row_index, 0, 0)
  end

  rows.map(&:evaluate)
end