Class: Cuker::RubyXLWriter
Constant Summary
AbstractWriter::NoNewFileMadeError
Instance Attribute Summary
#active_file, #active_file_name, #book, #ext, #out_dir
Attributes included from LoggerSetup
#log
Instance Method Summary
collapse
#make_name, #make_new_sheet, #new_name, #raise_unless_active_loc
#init_logger, reset_appender_log_levels
Methods included from Interface
#method
Constructor Details
Returns a new instance of RubyXLWriter.
7
8
9
10
11
12
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 7
def initialize
@ext = '.xlsm'
super
@template_file_name = "template_excel_jira.xlsm"
@log.debug "initing #{self.class}"
end
|
Instance Method Details
#finishup ⇒ Object
41
42
43
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 41
def finishup
@active_file.finishup if @active_file
end
|
#make_new_book(name) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 26
def make_new_book name
@log.debug "rxl make new sheet"
file_name = "#{name.nil? ? super(name) : name}#{ext}"
@book[file_name] = RubyXLFile.new file_name, @template_file_name
@active_file = @book[file_name]
file_name
end
|
#make_new_file(name) ⇒ Object
35
36
37
38
39
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 35
def make_new_file name
path = super name
finishup
make_new_book name
end
|
#write(model, output_file_path) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 45
def write model, output_file_path
file_name = make_new_file output_file_path
model.data.each(&method(:write_new_row))
finishup
file_name
end
|
#write_new_row(row_ary) ⇒ Object
20
21
22
23
24
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 20
def write_new_row row_ary
super row_ary
@log.trace "rxl write row: #{row_ary}"
@active_file.add_row row_ary
end
|
#write_title(title_ary) ⇒ Object
14
15
16
17
18
|
# File 'lib/cuker/helpers/writers/ruby_x_l_writer.rb', line 14
def write_title title_ary
super title_ary
@log.trace "rxl write title: #{title_ary}"
@active_file.add_row title_ary
end
|