Class: CopyTunerIncompatibleSearch::XlsxWriter
- Inherits:
-
Object
- Object
- CopyTunerIncompatibleSearch::XlsxWriter
- Defined in:
- lib/copy_tuner_incompatible_search/xlsx_writer.rb
Instance Method Summary collapse
-
#initialize(results, incompatible_keys, ignored_keys) ⇒ XlsxWriter
constructor
A new instance of XlsxWriter.
- #save_to(output_path) ⇒ Object
Constructor Details
#initialize(results, incompatible_keys, ignored_keys) ⇒ XlsxWriter
Returns a new instance of XlsxWriter.
5 6 7 8 9 |
# File 'lib/copy_tuner_incompatible_search/xlsx_writer.rb', line 5 def initialize(results, incompatible_keys, ignored_keys) @results = results @incompatible_keys = incompatible_keys @ignored_keys = ignored_keys end |
Instance Method Details
#save_to(output_path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/copy_tuner_incompatible_search/xlsx_writer.rb', line 11 def save_to(output_path) Axlsx::Package.new do |pkg| pkg.workbook.add_worksheet(name: 'Data') do |sheet| style = sheet.styles.add_style(font_name: 'Courier New', sz: 14) sheet.add_row %w[Type Key Ignored File Line Code], style: style sheet.auto_filter = 'A1:F1' freeze_pane(sheet) results.each do |result| add_result_rows(sheet, result, style) end end pkg.serialize(output_path) end end |