2010-08-16 20:26:12 -04:00
|
|
|
module Arel
|
|
|
|
module Nodes
|
|
|
|
class Binary
|
|
|
|
attr_accessor :left, :right
|
|
|
|
|
|
|
|
def initialize left, right
|
|
|
|
@left = left
|
|
|
|
@right = right
|
|
|
|
end
|
|
|
|
|
|
|
|
def or right
|
|
|
|
Nodes::Or.new self, right
|
|
|
|
end
|
|
|
|
|
|
|
|
# FIXME: this method should go away. I don't like people calling
|
|
|
|
# to_sql on non-head nodes. This forces us to walk the AST until we
|
|
|
|
# can find a node that has a "relation" member.
|
2010-08-16 20:27:16 -04:00
|
|
|
#
|
|
|
|
# Maybe we should just use `Table.engine`? :'(
|
2010-08-16 20:26:12 -04:00
|
|
|
def to_sql
|
2010-08-16 20:46:41 -04:00
|
|
|
viz = Visitors::ToSql.new Table.engine
|
2010-08-16 20:26:12 -04:00
|
|
|
viz.accept self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|