Class: ActiveRecord::StatementCache::PartialQueryCollector
- Inherits:
-
Object
- Object
- ActiveRecord::StatementCache::PartialQueryCollector
- Defined in:
- 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.
67 68 69 70 |
# File '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 'lib/active_record/statement_cache.rb', line 65 def preparable @preparable end |
#retryable ⇒ Object
Returns the value of attribute retryable.
65 66 67 |
# File 'lib/active_record/statement_cache.rb', line 65 def retryable @retryable end |
Instance Method Details
#<<(str) ⇒ Object
72 73 74 75 |
# File 'lib/active_record/statement_cache.rb', line 72 def <<(str) @parts << str self end |
#add_bind(obj) ⇒ Object
77 78 79 80 81 |
# File '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 '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 'lib/active_record/statement_cache.rb', line 92 def value [@parts, @binds] end |