Class: Shushu::UnitGroupPresenter
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_commas, #date_range, #money, #pennies_to_dollar, #trunc_hours
Constructor Details
Returns a new instance of UnitGroupPresenter.
6
7
8
|
# File 'lib/presenters/unit_group_presenter.rb', line 6
def initialize(unit_group)
@unit_group = unit_group
end
|
Instance Attribute Details
#unit_group ⇒ Object
Returns the value of attribute unit_group.
4
5
6
|
# File 'lib/presenters/unit_group_presenter.rb', line 4
def unit_group
@unit_group
end
|
Instance Method Details
#compacted_reports ⇒ Object
24
25
26
27
28
|
# File 'lib/presenters/unit_group_presenter.rb', line 24
def compacted_reports
[]
end
|
#daily_report_url ⇒ Object
18
19
20
21
22
|
# File 'lib/presenters/unit_group_presenter.rb', line 18
def daily_report_url
"/billable_units/daily"
end
|
#description ⇒ Object
46
47
48
|
# File 'lib/presenters/unit_group_presenter.rb', line 46
def description
@unit_group.description
end
|
#id ⇒ Object
10
11
12
|
# File 'lib/presenters/unit_group_presenter.rb', line 10
def id
[:hid, :name].map {|m| unit_group.send(m)}.join("_").gsub("-", "_")
end
|
#name ⇒ Object
42
43
44
|
# File 'lib/presenters/unit_group_presenter.rb', line 42
def name
@unit_group.name
end
|
#product_group ⇒ Object
54
55
56
|
# File 'lib/presenters/unit_group_presenter.rb', line 54
def product_group
@unit_group.product_group
end
|
#product_name ⇒ Object
50
51
52
|
# File 'lib/presenters/unit_group_presenter.rb', line 50
def product_name
@unit_group.product_name
end
|
#qty ⇒ Object
34
35
36
|
# File 'lib/presenters/unit_group_presenter.rb', line 34
def qty
trunc_hours(@unit_group.qty)
end
|
#rate ⇒ Object
38
39
40
|
# File 'lib/presenters/unit_group_presenter.rb', line 38
def rate
@unit_group.rate
end
|
#total ⇒ Object
30
31
32
|
# File 'lib/presenters/unit_group_presenter.rb', line 30
def total
money(@unit_group.total)
end
|
#unit_of_measure ⇒ Object
58
59
60
|
# File 'lib/presenters/unit_group_presenter.rb', line 58
def unit_of_measure
@unit_group.rate_period
end
|
#unit_presenters ⇒ Object
14
15
16
|
# File 'lib/presenters/unit_group_presenter.rb', line 14
def unit_presenters
@unit_presenters ||= @unit_group.units.map {|u| UnitPresenter.new(u)}
end
|