Class: Arel::Collectors::Bind
- Inherits:
-
Object
- Object
- Arel::Collectors::Bind
- Defined in:
- lib/arel/collectors/bind.rb
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #add_bind(bind) ⇒ Object
- #compile(bvs) ⇒ Object
-
#initialize ⇒ Bind
constructor
A new instance of Bind.
- #substitute_binds(bvs) ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize ⇒ Bind
Returns a new instance of Bind.
4 5 6 |
# File 'lib/arel/collectors/bind.rb', line 4 def initialize @parts = [] end |
Instance Method Details
#<<(str) ⇒ Object
8 9 10 11 |
# File 'lib/arel/collectors/bind.rb', line 8 def << str @parts << str self end |
#add_bind(bind) ⇒ Object
13 14 15 16 |
# File 'lib/arel/collectors/bind.rb', line 13 def add_bind bind @parts << bind self end |
#compile(bvs) ⇒ Object
31 32 33 |
# File 'lib/arel/collectors/bind.rb', line 31 def compile bvs substitute_binds(bvs).join end |
#substitute_binds(bvs) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/arel/collectors/bind.rb', line 20 def substitute_binds bvs bvs = bvs.dup @parts.map do |val| if Arel::Nodes::BindParam === val bvs.shift else val end end end |
#value ⇒ Object
18 |
# File 'lib/arel/collectors/bind.rb', line 18 def value; @parts; end |