blob: c316c8d7028980328302b239aa544e4259f76fcf (
plain) (
tree)
|
|
module Arel
module Visitors
module BindVisitor
def initialize target
@block = nil
super
end
def accept node, collector, &block
@block = block if block_given?
super
end
private
def visit_Arel_Nodes_Assignment o, collector
if o.right.is_a? Arel::Nodes::BindParam
collector = visit o.left, collector
collector << " = "
visit o.right, collector
else
super
end
end
def visit_Arel_Nodes_BindParam o, collector
if @block
@block.call(collector)
else
super
end
end
end
end
end
|