aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/grouping.rb
blob: ccca600360206aefb2494094cc030c45714fea5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Arel
  class Grouping < Compound
    attr_reader :expressions, :groupings

    def initialize(relation, *groupings)
      @relation, @groupings = relation, groupings.collect { |g| g.bind(relation) }
    end

    def ==(other)
      self.class  == other.class      and
      relation    == other.relation   and
      groupings   == other.groupings
    end

    def aggregation?
      true
    end
  end
end