123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::StatementCache::BindMap

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activerecord/lib/active_record/statement_cache.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(bound_attributes) ⇒ BindMap

[ GitHub ]

  
# File 'activerecord/lib/active_record/statement_cache.rb', line 114

def initialize(bound_attributes)
  @indexes = []
  @bound_attributes = bound_attributes

  bound_attributes.each_with_index do |attr, i|
    if ActiveModel::Attribute === attr && Substitute === attr.value
      @indexes << i
    end
  end
end

Instance Method Details

#bind(values)

[ GitHub ]

  
# File 'activerecord/lib/active_record/statement_cache.rb', line 125

def bind(values)
  bas = @bound_attributes.dup
  @indexes.each_with_index { |offset, i| bas[offset] = bas[offset].with_cast_value(values[i]) }
  bas
end