aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/bind_visitor.rb
blob: 0f1e38315bec7a00cdc041956c036fe989f450ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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