Module: ActiveRecord::Refined::AST::Aggregations

Included in:
Arithmetic, Column, Value
Defined in:
lib/active_record/refined/ast.rb

Overview

Aggregate builders shared by symbols, qualified columns and expressions. Imported into the Symbol refinement like Predications, so every method must be defined with def.

Instance Method Summary collapse

Instance Method Details

#averageObject



207
208
209
# File 'lib/active_record/refined/ast.rb', line 207

def average
  Aggregate.new(self, :average)
end

#count(distinct: false) ⇒ Object

DISTINCT is Arel's only aggregate modifier, and only for count.



199
200
201
# File 'lib/active_record/refined/ast.rb', line 199

def count(distinct: false)
  Aggregate.new(self, :count, distinct: distinct)
end

#maximumObject



211
212
213
# File 'lib/active_record/refined/ast.rb', line 211

def maximum
  Aggregate.new(self, :maximum)
end

#minimumObject



215
216
217
# File 'lib/active_record/refined/ast.rb', line 215

def minimum
  Aggregate.new(self, :minimum)
end

#sumObject



203
204
205
# File 'lib/active_record/refined/ast.rb', line 203

def sum
  Aggregate.new(self, :sum)
end