Class: ExportTo::Exporter::Xls
- Inherits:
-
Struct
- Object
- Struct
- ExportTo::Exporter::Xls
- Defined in:
- lib/export_to/exporter/xls.rb
Instance Attribute Summary collapse
-
#rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
Instance Attribute Details
#rows ⇒ Object
Returns the value of attribute rows
3 4 5 |
# File 'lib/export_to/exporter/xls.rb', line 3 def rows @rows end |
Instance Method Details
#to_xls ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/export_to/exporter/xls.rb', line 5 def to_xls book = Spreadsheet::Workbook.new sheet = book.create_worksheet rows.each! do |columns, model, x| sheet.row(x).concat(columns) end spreadsheet = StringIO.new book.write(spreadsheet) spreadsheet.string end |