aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/order.rb
blob: 6949b3acf7b7f04e6e22b7f146c38a5ba01fc490 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module ActiveRelation
  class Order < Compound
    attr_reader :orders

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

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

    def descend(&block)
      Order.new(relation.descend(&block), *orders.collect(&block))
    end
  end
end