blob: 91526da02cfc3348bfa23263f152c650a46ae04d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Arel
class Order < Compound
attr_reader :ordering
def initialize(relation, *orders)
ordering = orders.pop
@relation = orders.empty?? relation : Order.new(relation, *orders)
@ordering = ordering.bind(@relation)
end
def ==(other)
self.class == other.class and
relation == other.relation and
ordering == other.ordering
end
def orders
relation.orders + [ordering]
end
end
end
|