class Streamer::Functors::Subtract

Subtract subtracts a set of terms

Public Instance Methods

call() click to toggle source
# File lib/streamer/functors/subtract.rb, line 5
def call
  subtract
end
subtract() click to toggle source
# File lib/streamer/functors/subtract.rb, line 9
def subtract
  terms = options.fetch(:terms)
  initial_prop = terms.shift
  terms.inject(prop(initial_prop).to_f) do |total, item|
    total - prop(item).to_f
  end
end