class Streamer::Functors::Average

Average gives the average of a list given a property.

Public Instance Methods

call() click to toggle source
# File lib/streamer/functors/average.rb, line 5
def call
  Divide.new(
    payload,
    terms: [total, count]
  ).call
end
count() click to toggle source
# File lib/streamer/functors/average.rb, line 20
def count
  Count.new(payload, list: options.fetch(:list)).call
end
total() click to toggle source
# File lib/streamer/functors/average.rb, line 12
def total
  Sum.new(
    payload,
    list: options.fetch(:list),
    property: options.fetch(:property)
  ).call
end