Class: Prosperity::Aggregate::Average

Inherits:
WithColumn
  • Object
show all
Defined in:
lib/prosperity/aggregate/average.rb

Instance Attribute Summary

Attributes inherited from WithColumn

#column

Instance Method Summary collapse

Methods inherited from WithColumn

#initialize

Constructor Details

This class inherits a constructor from Prosperity::Aggregate::WithColumn

Instance Method Details

#apply(scope, options = {}) ⇒ Object



7
8
9
# File 'lib/prosperity/aggregate/average.rb', line 7

def apply(scope, options = {})
  scope.average(column)
end

#to_sqlObject



3
4
5
# File 'lib/prosperity/aggregate/average.rb', line 3

def to_sql
  "AVG(#{column})"
end