aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/operations/group.rb
blob: af0d3c680868bb46eb183f7c5b04cc153683049c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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

    def eval
      raise NotImplementedError
    end
  end
end