Class: Shushu::UnitPresenter

Inherits:
BasePresenter show all
Defined in:
lib/presenters/unit_presenter.rb

Instance Method Summary collapse

Methods inherited from BasePresenter

#add_commas, #date_range, #money, #pennies_to_dollar, #trunc_hours

Constructor Details

#initialize(unit) ⇒ UnitPresenter

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

#descriptionObject



28
29
30
# File 'lib/presenters/unit_presenter.rb', line 28

def description
  @unit.product_name
end

#endObject



24
25
26
# File 'lib/presenters/unit_presenter.rb', line 24

def end
  @unit.to
end

#qtyObject



16
17
18
# File 'lib/presenters/unit_presenter.rb', line 16

def qty
  trunc_hours(@unit.qty)
end

#rateObject



12
13
14
# File 'lib/presenters/unit_presenter.rb', line 12

def rate
  [money(@unit.rate), @unit.rate_period].join("/")
end

#startObject



20
21
22
# File 'lib/presenters/unit_presenter.rb', line 20

def start
  @unit.from
end

#totalObject



8
9
10
# File 'lib/presenters/unit_presenter.rb', line 8

def total
  money(@unit.total)
end