Class: Q::Syntax::Conditional
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Q::Syntax::Conditional
- Defined in:
- lib/q/syntax.rb
Instance Method Summary collapse
Instance Method Details
#eval(scope) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/q/syntax.rb', line 34 def eval scope if condition.eval(scope) == true return consequence.eval(scope) end if has_otherwise? return otherwise.consequence.eval(scope) end false end |
#has_otherwise? ⇒ Boolean
46 47 48 |
# File 'lib/q/syntax.rb', line 46 def has_otherwise? not otherwise.elements.nil? end |