Class: ImpExp::Exporters::Xlsx
- Defined in:
- app/services/imp_exp/exporters/xlsx.rb
Instance Attribute Summary
Attributes inherited from Base
#logger, #models, #scoping_parent
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ImpExp::Exporters::Base
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/services/imp_exp/exporters/xlsx.rb', line 8 def call super do rows_count = 0 package = Axlsx::Package.new models.each do |model| worksheet = package.workbook.add_worksheet(name: model.model_name) worksheet.add_row model.headers worksheet.add_row model.headers_translated model.rows(scoping_parent).each do |row| worksheet.add_row row, style: row_style(worksheet, model) rows_count += 1 end end { xlsx_stream: package.to_stream, rows_count: rows_count } end end |