Class: Streamer::Functors::Sum
- Defined in:
- lib/streamer/functors/sum.rb
Overview
Sum sums the list using the property provided
Instance Attribute Summary
Attributes inherited from Functor
Instance Method Summary collapse
Methods inherited from Functor
#class_name, #initialize, #type_name
Constructor Details
This class inherits a constructor from Streamer::Functors::Functor
Instance Method Details
#call ⇒ Object
5 6 7 8 9 |
# File 'lib/streamer/functors/sum.rb', line 5 def call list.inject(0.0) do |total, item| total + item[.fetch(:property)] end end |