Sha256: c9c44d6095fda5bd9bc875e94380bab9b574194e942315087d63652f07df1f28

Contents?: true

Size: 703 Bytes

Versions: 9

Compression:

Stored size: 703 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)
        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

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-6.1.3.2 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.3.1 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.3 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.2.1 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.2 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.1 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.0 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.0.rc2 lib/arel/collectors/substitute_binds.rb
activerecord-6.1.0.rc1 lib/arel/collectors/substitute_binds.rb