Class: ActiveRecord::StatementCache::BindMap
- Inherits:
-
Object
- Object
- ActiveRecord::StatementCache::BindMap
- Defined in:
- lib/active_record/statement_cache.rb
Overview
:nodoc:
Instance Method Summary collapse
- #bind(values) ⇒ Object
-
#initialize(bound_attributes) ⇒ BindMap
constructor
A new instance of BindMap.
Constructor Details
#initialize(bound_attributes) ⇒ BindMap
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/active_record/statement_cache.rb', line 118 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) ⇒ Object
129 130 131 132 133 |
# File 'lib/active_record/statement_cache.rb', line 129 def bind(values) bas = @bound_attributes.dup @indexes.each_with_index { |offset, i| bas[offset] = bas[offset].with_cast_value(values[i]) } bas end |