aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_relation/relations/order.rb
blob: a23da967fde8d35e87726b83852635dbe9e8799d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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

    def qualify
      Order.new(relation.qualify, *orders.collect(&:qualify))
    end
  end
end