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.
-
#retryable ⇒ Object
Returns the value of attribute retryable.
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.
71 72 73 74 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 71 def initialize @parts = [] @binds = [] end |
Instance Attribute Details
#preparable ⇒ Object
Returns the value of attribute preparable.
69 70 71 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 69 def preparable @preparable end |
#retryable ⇒ Object
Returns the value of attribute retryable.
69 70 71 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 69 def retryable @retryable end |
Instance Method Details
#<<(str) ⇒ Object
76 77 78 79 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 76 def <<(str) @parts << str self end |
#add_bind(obj) ⇒ Object
81 82 83 84 85 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 81 def add_bind(obj, &) @binds << obj @parts << Substitute.new self end |
#add_binds(binds, proc_for_binds = nil) ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 87 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
96 97 98 |
# File 'activerecord/lib/active_record/statement_cache.rb', line 96 def value [@parts, @binds] end |