module Arel::Visitors::BindVisitor

Public Class Methods

new(target) click to toggle source
Calls superclass method
# File lib/arel/visitors/bind_visitor.rb, line 4
def initialize target
  @block = nil
  super
end

Public Instance Methods

accept(node, collector, &block) click to toggle source
Calls superclass method
# File lib/arel/visitors/bind_visitor.rb, line 9
def accept node, collector, &block
  @block = block if block_given?
  super
end

Private Instance Methods

visit_Arel_Nodes_Assignment(o, collector) click to toggle source
Calls superclass method
# File lib/arel/visitors/bind_visitor.rb, line 16
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
visit_Arel_Nodes_BindParam(o, collector) click to toggle source
Calls superclass method
# File lib/arel/visitors/bind_visitor.rb, line 26
def visit_Arel_Nodes_BindParam o, collector
  if @block
    val = @block.call
    if String === val
      collector << val
    end
  else
    super
  end
end