Module: Reportabull::ClassMethods
- Defined in:
- lib/reportabull.rb
Instance Attribute Summary collapse
-
#report_builder ⇒ Object
Returns the value of attribute report_builder.
Instance Method Summary collapse
- #columns(options = {}, &block) ⇒ Object
- #to_csv(collection: nil) ⇒ Object
- #to_csv_enumrator(collection: nil) ⇒ Object
Instance Attribute Details
#report_builder ⇒ Object
Returns the value of attribute report_builder.
15 16 17 |
# File 'lib/reportabull.rb', line 15 def report_builder @report_builder end |
Instance Method Details
#columns(options = {}, &block) ⇒ Object
17 18 19 |
# File 'lib/reportabull.rb', line 17 def columns( = {}, &block) self.report_builder = ReportBuilder.new(, &block) end |
#to_csv(collection: nil) ⇒ Object
21 22 23 |
# File 'lib/reportabull.rb', line 21 def to_csv(collection: nil) report_builder.build(collection || find_collection, output: '', format: :csv) end |
#to_csv_enumrator(collection: nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/reportabull.rb', line 25 def to_csv_enumrator(collection: nil) Enumerator.new do |y| report_builder.build(collection || find_collection, output: y, format: :csv) end end |