lib/streamer/functors/sum.rb in streamer-0.1.1 vs lib/streamer/functors/sum.rb in streamer-0.2.0
- old
+ new
@@ -1,16 +1,13 @@
module Streamer
module Functors
# Sum sums the list using the property provided
class Sum < Functor
def call
- sum
- end
-
- def sum
- payload[options.fetch(:list)].inject(0.0) do |total, item|
+ list.inject(0.0) do |total, item|
total + item[options.fetch(:property)]
end
end
+
end
end
end