class ExcelUtils::Sheets::ExcelStream

Attributes

spreadsheet[R]

Public Class Methods

new(spreadsheet:, **options) click to toggle source
Calls superclass method ExcelUtils::Sheets::Base::new
# File lib/excel_utils/sheets/excel_stream.rb, line 5
def initialize(spreadsheet:, **options)
  super(**options)
  @spreadsheet = spreadsheet
end

Private Instance Methods

each_row() { |normalize_row(row)| ... } click to toggle source
# File lib/excel_utils/sheets/excel_stream.rb, line 19
def each_row
  sheet.each_row_streaming(pad_cells: true, offset: 1) do |row|
    yield normalize_row(row)
  end
end
first_row() click to toggle source
# File lib/excel_utils/sheets/excel_stream.rb, line 14
def first_row
  row = sheet.each_row_streaming(pad_cells: true, max_rows: 0).first || []
  normalize_row row
end
normalize_row(row) click to toggle source
# File lib/excel_utils/sheets/excel_stream.rb, line 25
def normalize_row(row)
  row.map { |cell| cell ? cell.value : cell }
end
sheet() click to toggle source
# File lib/excel_utils/sheets/excel_stream.rb, line 29
def sheet
  spreadsheet.sheet name
end