Module: Rapport::ReportGenerator
- Included in:
- ReportGeneratorFake, ReportGeneratorSimpleCsv
- Defined in:
- lib/rapport/report_generator.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#report ⇒ Object
Returns the value of attribute report.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#report ⇒ Object
Returns the value of attribute report.
57 58 59 |
# File 'lib/rapport/report_generator.rb', line 57 def report @report end |
Class Method Details
.from(report) ⇒ Object
4 5 6 7 |
# File 'lib/rapport/report_generator.rb', line 4 def self.from(report) = {:format => 'fake'}.merge(report.) Rapport.const_get("ReportGenerator#{Rapport.format_camel_case([:format].to_s)}").from(report) end |
.included(base) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/rapport/report_generator.rb', line 9 def self.included(base) base.extend(ClassMethods) base.instance_variable_set(:@cell_formatter, CellFormatter.new) def base.inherited(subclass) super(subclass) subclass.instance_variable_set(:@cell_formatter, base.instance_variable_get(:@cell_formatter).dup) end end |
Instance Method Details
#cell_formatter ⇒ Object
59 60 61 |
# File 'lib/rapport/report_generator.rb', line 59 def cell_formatter @cell_formatter ||= self.class.instance_variable_get(:@cell_formatter).dup end |
#format(type, value) ⇒ Object
63 64 65 |
# File 'lib/rapport/report_generator.rb', line 63 def format(type, value) cell_formatter.format(type, value) end |
#output_filename ⇒ Object
67 68 69 |
# File 'lib/rapport/report_generator.rb', line 67 def output_filename @output_filename ||= File.join(@options[:output_dir] || '.', "#{report_name}_#{Time.now.strftime('%Y-%m-%d-%H%M%S')}.csv") end |