class Sleek::Queries::Average

Internal: Average query.

Finds the average value for a given property.

target_property - the String name of target property on event.

Examples

sleek.queries.average(:purchases, target_property: "total")
# => 49_35

Public Instance Methods

perform(events) click to toggle source
# File lib/sleek/queries/average.rb, line 16
def perform(events)
  events.avg target_property
end