aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/operations/group.rb
blob: 68c626e917985d47dfd7ca6bb0a49776b582e7e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Arel
  class Group < Compound
    attr_reader :groupings

    def initialize(relation, *groupings, &block)
      super(relation)
      @groupings = (groupings + arguments_from_block(relation, &block)) \
        .collect { |g| g.bind(relation) }
    end

    def == other
      super ||
        self.class === other &&
        @relation == other.relation &&
        @groupings == other.groupings
    end
  end
end