Class: Agilibox::Serializers::XLSX

Inherits:
Base
  • Object
show all
Defined in:
app/serializers/agilibox/serializers/xlsx.rb

Instance Attribute Summary

Attributes inherited from Base

#data, #options

Instance Method Summary collapse

Methods inherited from Base

format, format_boolean, format_datetime, format_decimal, format_default, format_integer, #formatted_data, formatter_for, #initialize

Constructor Details

This class inherits a constructor from Agilibox::Serializers::Base

Instance Method Details

#render_file(file_path) ⇒ Object



7
8
9
10
11
# File 'app/serializers/agilibox/serializers/xlsx.rb', line 7

def render_file(file_path)
  File.open(file_path, "w+b") do |f|
    f.write(render_inline)
  end
end

#render_inlineObject



2
3
4
5
# File 'app/serializers/agilibox/serializers/xlsx.rb', line 2

def render_inline
  headers, *data = formatted_data
  SpreadsheetArchitect.to_xlsx(headers: headers, data: data, freeze_headers: true)
end