diff options
Diffstat (limited to 'lib/arel/visitors/bind_visitor.rb')
-rw-r--r-- | lib/arel/visitors/bind_visitor.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/arel/visitors/bind_visitor.rb b/lib/arel/visitors/bind_visitor.rb new file mode 100644 index 0000000000..0f1e38315b --- /dev/null +++ b/lib/arel/visitors/bind_visitor.rb @@ -0,0 +1,24 @@ +module Arel + module Visitors + module BindVisitor + def initialize target + @block = nil + super + end + + def accept node, &block + @block = block if block_given? + super + end + + private + def visit_Arel_Nodes_BindParam o + if @block + @block.call + else + super + end + end + end + end +end |