Class: Arel::Collectors::SQLString
- Inherits:
-
PlainString
- Object
- PlainString
- Arel::Collectors::SQLString
- Defined in:
- activerecord/lib/arel/collectors/sql_string.rb
Instance Attribute Summary collapse
-
#preparable ⇒ Object
Returns the value of attribute preparable.
Instance Method Summary collapse
- #add_bind(bind) ⇒ Object
- #add_binds(binds, proc_for_binds = nil, &block) ⇒ Object
-
#initialize ⇒ SQLString
constructor
A new instance of SQLString.
Methods inherited from PlainString
Constructor Details
#initialize ⇒ SQLString
Returns a new instance of SQLString.
10 11 12 13 |
# File 'activerecord/lib/arel/collectors/sql_string.rb', line 10 def initialize(*) super @bind_index = 1 end |
Instance Attribute Details
#preparable ⇒ Object
Returns the value of attribute preparable
8 9 10 |
# File 'activerecord/lib/arel/collectors/sql_string.rb', line 8 def preparable @preparable end |
Instance Method Details
#add_bind(bind) ⇒ Object
15 16 17 18 19 |
# File 'activerecord/lib/arel/collectors/sql_string.rb', line 15 def add_bind(bind) self << yield(@bind_index) @bind_index += 1 self end |
#add_binds(binds, proc_for_binds = nil, &block) ⇒ Object
21 22 23 24 |
# File 'activerecord/lib/arel/collectors/sql_string.rb', line 21 def add_binds(binds, proc_for_binds = nil, &block) self << (@bind_index...@bind_index += binds.size).map(&block).join(", ") self end |