aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/alias.rb
blob: f24b1d743c76afa8796ce71032ac85f9a9903213 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module ActiveRelation
  class Alias < Compound
    attr_reader :alias

    def initialize(relation, aliaz)
      @relation, @alias = relation, aliaz
    end
    
    def alias?
      true
    end
    
    def descend(&block)
      Alias.new(relation.descend(&block), @alias)
    end

    def ==(other)
      self.class == other.class and
      relation   == other.relation and
      @alias     == other.alias
    end
  end
end