Class: Pomodoro::Formats::Review::Plugins::Consumption::ConsumptionItems

Inherits:
Object
  • Object
show all
Defined in:
lib/pomodoro/formats/review/plugins/consumption.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ ConsumptionItems

Returns a new instance of ConsumptionItems.


55
56
57
# File 'lib/pomodoro/formats/review/plugins/consumption.rb', line 55

def initialize(items)
  @items = items
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items


54
55
56
# File 'lib/pomodoro/formats/review/plugins/consumption.rb', line 54

def items
  @items
end

Instance Method Details

#sumObject


59
60
61
# File 'lib/pomodoro/formats/review/plugins/consumption.rb', line 59

def sum
  @items.sum(&:units)
end