Class: Zaid::Nodes::IfNode
- Inherits:
-
Struct
- Object
- Struct
- Zaid::Nodes::IfNode
- Defined in:
- lib/zaid/nodes/if_node.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#condition ⇒ Object
Returns the value of attribute condition.
-
#else_body ⇒ Object
Returns the value of attribute else_body.
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
5 6 7 |
# File 'lib/zaid/nodes/if_node.rb', line 5 def body @body end |
#condition ⇒ Object
Returns the value of attribute condition
5 6 7 |
# File 'lib/zaid/nodes/if_node.rb', line 5 def condition @condition end |
#else_body ⇒ Object
Returns the value of attribute else_body
5 6 7 |
# File 'lib/zaid/nodes/if_node.rb', line 5 def else_body @else_body end |
Instance Method Details
#eval(context) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/zaid/nodes/if_node.rb', line 6 def eval(context) if condition.eval(context).ruby_value body.eval(context) elsif else_body else_body.eval(context) else Constants['مجهول'] end end |