Class: TwoWaySQL::ParenBindVariableNode
- Defined in:
- lib/twowaysql/node.rb
Instance Method Summary collapse
- #accept(ctx) ⇒ Object
- #bind_values(ctx, ary) ⇒ Object
-
#initialize(exp) ⇒ ParenBindVariableNode
constructor
A new instance of ParenBindVariableNode.
Constructor Details
#initialize(exp) ⇒ ParenBindVariableNode
Returns a new instance of ParenBindVariableNode.
171 172 173 |
# File 'lib/twowaysql/node.rb', line 171 def initialize(exp) @exp = exp end |
Instance Method Details
#accept(ctx) ⇒ Object
174 175 176 177 178 179 180 181 182 |
# File 'lib/twowaysql/node.rb', line 174 def accept(ctx) result = do_eval(ctx, @exp) return if result.nil? if result.respond_to?('to_ary') bind_values(ctx, result.to_ary) else ctx.add_value(result) end end |
#bind_values(ctx, ary) ⇒ Object
183 184 185 186 187 188 |
# File 'lib/twowaysql/node.rb', line 183 def bind_values(ctx, ary) return if ary.empty? ctx.add_sql("(") ctx.add_values(ary) ctx.add_sql(")") end |