lib/sql_tree/node/ordering.rb in sql_tree-0.0.2 vs lib/sql_tree/node/ordering.rb in sql_tree-0.0.3

- old
+ new

@@ -1,20 +1,20 @@ module SQLTree::Node - + class Ordering < Base - + attr_accessor :expression, :direction - + def initialize(expression, direction = nil) @expression, @direction = expression, direction end - + def to_sql sql = expression.to_sql sql << " #{direction.to_s.upcase}" if direction sql end - + def self.parse(tokens) ordering = self.new(SQLTree::Node::Expression.parse(tokens)) if tokens.peek && tokens.peek.direction? ordering.direction = tokens.next.literal.downcase.to_sym end \ No newline at end of file