Class: ActiveRecord::StatementCache::PartialQueryCollector
- Defined in:
- activerecord/lib/active_record/statement_cache.rb
Instance Attribute Summary collapse
-
#preparable ⇒ Object
Returns the value of attribute preparable.
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #add_bind(obj) ⇒ Object
- #add_binds(binds, proc_for_binds = nil) ⇒ Object
-
#initialize ⇒ PartialQueryCollector
constructor
A new instance of PartialQueryCollector.
- #value ⇒ Object
Constructor Details
#initialize ⇒ PartialQueryCollector
Returns a new instance of PartialQueryCollector.
67 68 69 70 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 67 def initialize @parts = [] @binds = [] end |
Instance Attribute Details
#preparable ⇒ Object
Returns the value of attribute preparable
65 66 67 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 65 def preparable @preparable end |
Instance Method Details
#<<(str) ⇒ Object
72 73 74 75 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 72 def <<(str) @parts << str self end |
#add_bind(obj) ⇒ Object
77 78 79 80 81 |
# 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) ⇒ Object
83 84 85 86 87 88 89 90 |
# 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 ⇒ Object
92 93 94 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 92 def value [@parts, @binds] end |