Sha256: a5975fb0fc9ac96a227a22c1cf7997fa7aa9a9577740bf3d01490d33f6976cbe

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

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_Assignment o
        if o.right.is_a? Arel::Nodes::BindParam
          "#{visit o.left} = #{visit o.right}"
        else
          super
        end
      end

      def visit_Arel_Nodes_BindParam o
        if @block
          @block.call
        else
          super
        end
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
challah-1.0.0 vendor/bundle/gems/arel-4.0.0/lib/arel/visitors/bind_visitor.rb
arel-4.0.0 lib/arel/visitors/bind_visitor.rb
arel-4.0.0.beta2 lib/arel/visitors/bind_visitor.rb
arel-4.0.0.beta1 lib/arel/visitors/bind_visitor.rb