aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/ordering.rb
blob: 984327aaf7061ed978d3df8923b4e320e2ca13cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Arel
  class Ordering < Struct.new(:attribute)
    delegate :relation, :to => :attribute

    def bind(relation)
      self.class.new(attribute.bind(relation))
    end

    def to_ordering
      self
    end

    def == other
      super || (self.class === other && attribute == other.attribute)
    end
  end

  class Ascending  < Ordering
  end
  class Descending < Ordering
  end
end