Class: Arel::Collectors::SubstituteBinds
- Inherits:
-
Object
- Object
- Arel::Collectors::SubstituteBinds
- Defined in:
- lib/arel/collectors/substitute_binds.rb
Instance Attribute Summary collapse
-
#preparable ⇒ Object
Returns the value of attribute preparable.
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #add_bind(bind) ⇒ Object
- #add_binds(binds, proc_for_binds = nil) ⇒ Object
-
#initialize(quoter, delegate_collector) ⇒ SubstituteBinds
constructor
A new instance of SubstituteBinds.
- #value ⇒ Object
Constructor Details
#initialize(quoter, delegate_collector) ⇒ SubstituteBinds
Returns a new instance of SubstituteBinds.
8 9 10 11 |
# File 'lib/arel/collectors/substitute_binds.rb', line 8 def initialize(quoter, delegate_collector) @quoter = quoter @delegate = delegate_collector end |
Instance Attribute Details
#preparable ⇒ Object
Returns the value of attribute preparable.
6 7 8 |
# File 'lib/arel/collectors/substitute_binds.rb', line 6 def preparable @preparable end |
Instance Method Details
#<<(str) ⇒ Object
13 14 15 16 |
# File 'lib/arel/collectors/substitute_binds.rb', line 13 def <<(str) delegate << str self end |
#add_bind(bind) ⇒ Object
18 19 20 21 |
# File 'lib/arel/collectors/substitute_binds.rb', line 18 def add_bind(bind) bind = bind.value_for_database if bind.respond_to?(:value_for_database) self << quoter.quote(bind) end |
#add_binds(binds, proc_for_binds = nil) ⇒ Object
23 24 25 |
# File 'lib/arel/collectors/substitute_binds.rb', line 23 def add_binds(binds, proc_for_binds = nil) self << binds.map { |bind| quoter.quote(bind) }.join(", ") end |
#value ⇒ Object
27 28 29 |
# File 'lib/arel/collectors/substitute_binds.rb', line 27 def value delegate.value end |