Class: Confuscript::Nodes::IfElseNode
- Inherits:
-
BaseNode
- Object
- Treetop::Runtime::SyntaxNode
- BaseNode
- Confuscript::Nodes::IfElseNode
- Defined in:
- lib/confuscript/nodes/if_else_node.rb
Instance Method Summary collapse
-
#evaluate(context) ⇒ Object
Since the condition is inverse, we evaluate the ‘else’ block if the condition is true.
Methods inherited from BaseNode
Instance Method Details
#evaluate(context) ⇒ Object
Since the condition is inverse, we evaluate the ‘else’ block if the condition is true
5 6 7 8 9 10 11 |
# File 'lib/confuscript/nodes/if_else_node.rb', line 5 def evaluate(context) if if_clause.comparison.evaluate(context) else_clause.block.evaluate(context) if else_clause.respond_to?(:block) else if_clause.block.evaluate(context) end end |