aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/projection.rb
blob: 9651acd0212a872d5c8b4ebba7839c6a6d64e878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module ActiveRelation
  class Projection < Compound
    attr_reader :projections
    
    def initialize(relation, *projections)
      @relation, @projections = relation, projections
    end

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

    def qualify
      Projection.new(relation.qualify, *projections.collect(&:qualify))
    end
  end
end