aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/ordering.rb
blob: d395c8631d0bc45a4148ad74f76ec4354554d1eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Arel
  module Nodes
    class Ordering < Arel::Nodes::Node
      attr_accessor :expr, :direction

      def initialize expression, direction = :asc
        @expr, @direction = expression, direction
      end

      def ascending?
        direction == :asc
      end

      def descending?
        direction == :desc
      end
    end
  end
end