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.
101 102 103 104 105 |
# File 'lib/twowaysql/node.rb', line 101 def initialize(cond, tstmt, fstmt) @condition = cond @tstmt = tstmt @fstmt = fstmt end |
Instance Method Details
#accept(ctx) ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/twowaysql/node.rb', line 106 def accept(ctx) if do_eval(ctx, @condition) exec_list(@tstmt, ctx) ctx.enable! elsif @fstmt exec_list(@fstmt, ctx) ctx.enable! end end |