aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/ordering.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/nodes/ordering.rb')
-rw-r--r--lib/arel/nodes/ordering.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/arel/nodes/ordering.rb b/lib/arel/nodes/ordering.rb
new file mode 100644
index 0000000000..d395c8631d
--- /dev/null
+++ b/lib/arel/nodes/ordering.rb
@@ -0,0 +1,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