Class: Shushu::LineItem
- Inherits:
-
Object
- Object
- Shushu::LineItem
- Defined in:
- lib/models/line_item.rb
Instance Attribute Summary collapse
-
#unit_groups ⇒ Object
readonly
Returns the value of attribute unit_groups.
Instance Method Summary collapse
- #app_name ⇒ Object
-
#initialize(unit_groups) ⇒ LineItem
constructor
A new instance of LineItem.
- #total ⇒ Object
Constructor Details
#initialize(unit_groups) ⇒ LineItem
Returns a new instance of LineItem.
6 7 8 |
# File 'lib/models/line_item.rb', line 6 def initialize(unit_groups) @unit_groups = unit_groups end |
Instance Attribute Details
#unit_groups ⇒ Object (readonly)
Returns the value of attribute unit_groups.
4 5 6 |
# File 'lib/models/line_item.rb', line 4 def unit_groups @unit_groups end |
Instance Method Details
#app_name ⇒ Object
10 11 12 |
# File 'lib/models/line_item.rb', line 10 def app_name @unit_groups.first.hid end |
#total ⇒ Object
14 15 16 |
# File 'lib/models/line_item.rb', line 14 def total @unit_groups.map(&:total).reduce(:+) end |