Sha256: a8dc238076e4e219f352dfb54aebb6586ac1cec7086f13def0edd2b26f776827

Contents?: true

Size: 725 Bytes

Versions: 85

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Arel # :nodoc: all
  module Collectors
    class SubstituteBinds
      attr_accessor :preparable

      def initialize(quoter, delegate_collector)
        @quoter = quoter
        @delegate = delegate_collector
      end

      def <<(str)
        delegate << str
        self
      end

      def add_bind(bind)
        bind = bind.value_for_database if bind.respond_to?(:value_for_database)
        self << quoter.quote(bind)
      end

      def add_binds(binds, proc_for_binds = nil)
        self << binds.map { |bind| quoter.quote(bind) }.join(", ")
      end

      def value
        delegate.value
      end

      private
        attr_reader :quoter, :delegate
    end
  end
end

Version data entries

85 entries across 80 versions & 8 rubygems

Version Path
activerecord-6.1.7.7 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.3 lib/arel/collectors/substitute_binds.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/arel/collectors/substitute_binds.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.3.1/lib/arel/collectors/substitute_binds.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-7.0.2.3/lib/arel/collectors/substitute_binds.rb
activerecord-7.1.2 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.1 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.0 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.0.rc2 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.0.rc1 lib/arel/collectors/substitute_binds.rb
activerecord-7.1.0.beta1 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.8 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.7.2 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.7.6 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.7.1 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.7.5 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.7 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.6 lib/arel/collectors/substitute_binds.rb
activerecord-7.0.5.1 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.7.4 lib/arel/collectors/substitute_binds.rb