aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/order.rb
blob: 90568a90ac3f80be0c8920efb802f13d771c5b30 (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)
      relation == other.relation and
      orders   == other.orders
    end

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