123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::StatementCache::PartialQueryCollector

Relationships & Source Files
Inherits: Object
Defined in: activerecord/lib/active_record/statement_cache.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.newPartialQueryCollector

[ GitHub ]

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

def initialize
  @parts = []
  @binds = []
end

Instance Attribute Details

#preparable (rw)

[ GitHub ]

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

attr_accessor :preparable

Instance Method Details

#<<(str)

[ GitHub ]

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

def <<(str)
  @parts << str
  self
end

#add_bind(obj)

[ GitHub ]

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

def add_bind(obj)
  @binds << obj
  @parts << Substitute.new
  self
end

#add_binds(binds, proc_for_binds = nil)

[ GitHub ]

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

def add_binds(binds, proc_for_binds = nil)
  @binds.concat proc_for_binds ? binds.map(&proc_for_binds) : binds
  binds.size.times do |i|
    @parts << ", " unless i == 0
    @parts << Substitute.new
  end
  self
end

#value

[ GitHub ]

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

def value
  [@parts, @binds]
end