class ExcelSerializer::Worksheet

Attributes

row_counter[RW]
sheet[RW]

Public Class Methods

new(current_excel, sheet_name) click to toggle source
# File lib/excel_serializer/worksheet.rb, line 5
def initialize(current_excel, sheet_name)
  @sheet = current_excel.add_worksheet(sheet_name)
  @row_counter = 0
end

Public Instance Methods

write_headers(headers) click to toggle source
# File lib/excel_serializer/worksheet.rb, line 17
def write_headers(headers)
  headers.each_with_index do |value, current_column|
    @sheet.write(0, current_column, value)
  end
end
write_row(row) click to toggle source
# File lib/excel_serializer/worksheet.rb, line 10
def write_row(row)
  row_index = @row_counter += 1
  row.each_with_index do |value, current_column|
    @sheet.write(row_index, current_column, value)
  end
end