lib/sql_tree/node/field.rb in sql_tree-0.0.2 vs lib/sql_tree/node/field.rb in sql_tree-0.0.3
- old
+ new
@@ -1,7 +1,7 @@
module SQLTree::Node
-
+
class Field < Base
attr_accessor :name, :table
alias :field :name
@@ -18,14 +18,14 @@
end
def to_sql
@table.nil? ? quote_var(@name) : quote_var(@table) + '.' + quote_var(@name)
end
-
+
def ==(other)
other.name == self.name && other.table == self.table
end
-
+
def self.parse(tokens)
field_or_table = case tokens.next
when SQLTree::Token::MULTIPLY then :all
when SQLTree::Token::Variable then tokens.current.literal
else raise SQLTree::Parser::UnexpectedToken.new(tokens.current)