Class: Timely::Formats::Excel
- Inherits:
-
Timely::Formatter
- Object
- Timely::Formatter
- Timely::Formats::Excel
- Defined in:
- lib/timely/formats/excel.rb
Constant Summary collapse
- CELL_FORMATS =
{ title: Spreadsheet::Format.new(bold: true, size: 14), headings: Spreadsheet::Format.new(bold: true, size: 10, align: 'right'), values: Spreadsheet::Format.new(align: 'right') }
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#workbook ⇒ Object
readonly
Returns the value of attribute workbook.
-
#worksheet ⇒ Object
readonly
Returns the value of attribute worksheet.
Attributes inherited from Timely::Formatter
Instance Method Summary collapse
-
#initialize(report, options = {}) ⇒ Excel
constructor
A new instance of Excel.
- #output ⇒ Object
Methods inherited from Timely::Formatter
Constructor Details
#initialize(report, options = {}) ⇒ Excel
Returns a new instance of Excel.
14 15 16 17 18 19 20 21 |
# File 'lib/timely/formats/excel.rb', line 14 def initialize(report, ={}) super @path = [:path] || Tempfile.new('timely-excel').path @row_idx = 0 @workbook = Spreadsheet::Workbook.new @worksheet = create_worksheet end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
12 13 14 |
# File 'lib/timely/formats/excel.rb', line 12 def path @path end |
#workbook ⇒ Object (readonly)
Returns the value of attribute workbook.
12 13 14 |
# File 'lib/timely/formats/excel.rb', line 12 def workbook @workbook end |
#worksheet ⇒ Object (readonly)
Returns the value of attribute worksheet.
12 13 14 |
# File 'lib/timely/formats/excel.rb', line 12 def worksheet @worksheet end |
Instance Method Details
#output ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/timely/formats/excel.rb', line 23 def output write_title write_columns write_rows write_generated_at save_workbook path end |