Class: BMC::Serializers::XLSX

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

Instance Attribute Summary

Attributes inherited from Base

#data, #options

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

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

Instance Method Details

#render_file(file_path) ⇒ Object



13
14
15
# File 'app/serializers/bmc/serializers/xlsx.rb', line 13

def render_file(file_path)
  File.binwrite(file_path, render_inline)
end

#render_inlineObject



2
3
4
5
6
7
8
9
10
11
# File 'app/serializers/bmc/serializers/xlsx.rb', line 2

def render_inline
  headers, *data = formatted_data

  SpreadsheetArchitect.to_xlsx(
    headers:,
    data:,
    freeze_headers: true,
    range_styles: range_styles(data[0]),
  )
end