Class: Shushu::UnitPresenter
Instance Method Summary
collapse
#add_commas, #date_range, #money, #pennies_to_dollar, #trunc_hours
Constructor Details
Returns a new instance of UnitPresenter.
4
5
6
|
# File 'lib/presenters/unit_presenter.rb', line 4
def initialize(unit)
@unit = unit
end
|
Instance Method Details
#description ⇒ Object
28
29
30
|
# File 'lib/presenters/unit_presenter.rb', line 28
def description
@unit.product_name
end
|
#end ⇒ Object
24
25
26
|
# File 'lib/presenters/unit_presenter.rb', line 24
def end
@unit.to
end
|
#qty ⇒ Object
16
17
18
|
# File 'lib/presenters/unit_presenter.rb', line 16
def qty
trunc_hours(@unit.qty)
end
|
#rate ⇒ Object
12
13
14
|
# File 'lib/presenters/unit_presenter.rb', line 12
def rate
[money(@unit.rate), @unit.rate_period].join("/")
end
|
#start ⇒ Object
20
21
22
|
# File 'lib/presenters/unit_presenter.rb', line 20
def start
@unit.from
end
|
#total ⇒ Object
8
9
10
|
# File 'lib/presenters/unit_presenter.rb', line 8
def total
money(@unit.total)
end
|