Sha256: c8e7d589c95f0b3a15e415cb432b6691705f0de3ff02b128aa6d6e0c463d938b

Contents?: true

Size: 737 Bytes

Versions: 23

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

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

      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

23 entries across 23 versions & 2 rubygems

Version Path
activerecord-8.0.1 lib/arel/collectors/substitute_binds.rb
activerecord-8.0.0.1 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.2.1 lib/arel/collectors/substitute_binds.rb
activerecord-8.0.0 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.2 lib/arel/collectors/substitute_binds.rb
activerecord-8.0.0.rc2 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.1.2 lib/arel/collectors/substitute_binds.rb
activerecord-8.0.0.rc1 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.1.1 lib/arel/collectors/substitute_binds.rb
activerecord-8.0.0.beta1 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha9 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha8 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha7 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha4 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha3 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha2 lib/arel/collectors/substitute_binds.rb
omg-activerecord-8.0.0.alpha1 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.1 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.0 lib/arel/collectors/substitute_binds.rb
activerecord-7.2.0.rc1 lib/arel/collectors/substitute_binds.rb