Class: TwoWaySQL::IfNode
Instance Method Summary collapse
- #accept(ctx) ⇒ Object
-
#initialize(cond, tstmt, fstmt) ⇒ IfNode
constructor
A new instance of IfNode.
Constructor Details
#initialize(cond, tstmt, fstmt) ⇒ IfNode
Returns a new instance of IfNode.
104 105 106 107 108 |
# File 'lib/twowaysql/node.rb', line 104 def initialize(cond, tstmt, fstmt) @condition = cond @tstmt = tstmt @fstmt = fstmt end |
Instance Method Details
#accept(ctx) ⇒ Object
109 110 111 112 113 114 115 116 117 |
# File 'lib/twowaysql/node.rb', line 109 def accept(ctx) if do_eval(ctx, @condition) exec_list(@tstmt, ctx) ctx.enable! elsif @fstmt exec_list(@fstmt, ctx) ctx.enable! end end |