diff options
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/ordering.rb | 19 |
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 |