Class: Shushu::LineItem

Inherits:
Object
  • Object
show all
Defined in:
lib/models/line_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_groupsObject (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_nameObject



10
11
12
# File 'lib/models/line_item.rb', line 10

def app_name
  @unit_groups.first.hid
end

#totalObject



14
15
16
# File 'lib/models/line_item.rb', line 14

def total
  @unit_groups.map(&:total).reduce(:+)
end