Class: Shushu::ReportPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- Shushu::ReportPresenter
- Defined in:
- lib/presenters/report_presenter.rb
Instance Method Summary collapse
-
#initialize(report, line_item_builder = LineItemBuilder) ⇒ ReportPresenter
constructor
A new instance of ReportPresenter.
- #line_item_presenters ⇒ Object
- #total ⇒ Object
Methods inherited from BasePresenter
#add_commas, #date_range, #money, #pennies_to_dollar, #trunc_hours
Constructor Details
#initialize(report, line_item_builder = LineItemBuilder) ⇒ ReportPresenter
Returns a new instance of ReportPresenter.
4 5 6 7 8 |
# File 'lib/presenters/report_presenter.rb', line 4 def initialize(report, line_item_builder=LineItemBuilder) @report = report @units = @report.billable_units @builder = line_item_builder end |
Instance Method Details
#line_item_presenters ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/presenters/report_presenter.rb', line 14 def line_item_presenters @line_item_presenters ||= begin @builder.build(@units).map do |li| LineItemPresenter.new(li) end end end |
#total ⇒ Object
10 11 12 |
# File 'lib/presenters/report_presenter.rb', line 10 def total money(@report.total) end |