Class: Cuker::SummaryXLWriter
- Inherits:
-
RubyXLWriter
- Object
- AbstractWriter
- RubyXLWriter
- Cuker::SummaryXLWriter
- Defined in:
- lib/cuker/helpers/writers/summary_x_l_writer.rb
Constant Summary
Constants inherited from AbstractWriter
AbstractWriter::NoNewFileMadeError
Instance Attribute Summary
Attributes inherited from AbstractWriter
#active_file, #active_file_name, #book, #ext, #out_dir
Attributes included from LoggerSetup
Instance Method Summary collapse
-
#initialize ⇒ SummaryXLWriter
constructor
A new instance of SummaryXLWriter.
- #make_new_book(name) ⇒ Object
- #write(model, output_file_path) ⇒ Object
Methods inherited from RubyXLWriter
#finishup, #make_new_file, #write_new_row, #write_title
Methods inherited from AbstractWriter
#finishup, #make_name, #make_new_file, #make_new_sheet, #new_name, #raise_unless_active_loc, #write_new_row, #write_title
Methods included from LoggerSetup
#init_logger, reset_appender_log_levels
Methods included from Interface
Constructor Details
#initialize ⇒ SummaryXLWriter
Returns a new instance of SummaryXLWriter.
7 8 9 10 11 12 |
# File 'lib/cuker/helpers/writers/summary_x_l_writer.rb', line 7 def initialize # @ext = '.xlsm' super @template_file_name = "template_excel_summary.xlsm" @log.debug "initing #{self.class}" end |
Instance Method Details
#make_new_book(name) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/cuker/helpers/writers/summary_x_l_writer.rb', line 14 def make_new_book name @log.debug "summary rxl make new sheet" #todo: dangit! handling this path naming properly file_name = "#{name.nil? ? super(name) : name}#{ext}" @book[file_name] = SummaryRubyXLFile.new file_name, @template_file_name @active_file = @book[file_name] file_name end |
#write(model, output_file_path) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cuker/helpers/writers/summary_x_l_writer.rb', line 23 def write model, output_file_path file_name = make_new_file output_file_path write_title model.title model.data.each {|row| write_new_row row} finishup file_name end |