Sha256: ae5c0f5466e16b5b36de453b8d702f20c18f1315288580155774f67495f21d99

Contents?: true

Size: 557 Bytes

Versions: 23

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

require "arel/collectors/plain_string"

module Arel # :nodoc: all
  module Collectors
    class SQLString < PlainString
      attr_accessor :preparable, :retryable

      def initialize(*)
        super
        @bind_index = 1
      end

      def add_bind(bind)
        self << yield(@bind_index)
        @bind_index += 1
        self
      end

      def add_binds(binds, proc_for_binds = nil, &block)
        self << (@bind_index...@bind_index += binds.size).map(&block).join(", ")
        self
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

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