lib/sql_tree/node/ordering.rb in sql_tree-0.1.0 vs lib/sql_tree/node/ordering.rb in sql_tree-0.1.1
- old
+ new
@@ -1,16 +1,17 @@
module SQLTree::Node
class Ordering < Base
- attr_accessor :expression, :direction
+ child :expression
+ leaf :direction
def initialize(expression, direction = nil)
@expression, @direction = expression, direction
end
- def to_sql
- sql = expression.to_sql
+ def to_sql(options = {})
+ sql = expression.to_sql(options)
sql << " #{direction.to_s.upcase}" if direction
sql
end
def self.parse(tokens)
\ No newline at end of file