aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/projection.rb
blob: 211e0607ac328242015e9270024dccef08b812c7 (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 :attributes

    def initialize(relation, *attributes)
      @relation, @attributes = relation, attributes
    end

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

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