1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/arel/expressions.rb

30 lines
447 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-02-24 01:45:50 -05:00
2018-02-24 02:41:47 -05:00
module Arel # :nodoc: all
2010-09-14 18:20:24 -04:00
module Expressions
2018-02-24 01:45:50 -05:00
def count(distinct = false)
2010-09-14 18:20:24 -04:00
Nodes::Count.new [self], distinct
end
def sum
Nodes::Sum.new [self]
2010-09-14 18:20:24 -04:00
end
def maximum
Nodes::Max.new [self]
2010-09-14 18:20:24 -04:00
end
def minimum
Nodes::Min.new [self]
2010-09-14 18:20:24 -04:00
end
def average
Nodes::Avg.new [self]
2010-09-14 18:20:24 -04:00
end
2018-02-24 01:45:50 -05:00
def extract(field)
Nodes::Extract.new [self], field
end
2010-09-14 18:20:24 -04:00
end
end