Class: IfNode
Overview
If Statement Nodes
Instance Attribute Summary collapse
-
#argument ⇒ Object
Returns the value of attribute argument.
Attributes inherited from Node
Instance Method Summary collapse
- #create_tree_entry ⇒ Object
- #evaluate ⇒ Object
-
#initialize(argument, node) ⇒ IfNode
constructor
A new instance of IfNode.
- #to_s ⇒ Object
Constructor Details
#initialize(argument, node) ⇒ IfNode
Returns a new instance of IfNode.
162 163 164 |
# File 'lib/nodes/stmtnodes.rb', line 162 def initialize(argument, node) @argument, @node = argument, node end |
Instance Attribute Details
#argument ⇒ Object
Returns the value of attribute argument.
160 161 162 |
# File 'lib/nodes/stmtnodes.rb', line 160 def argument @argument end |
Instance Method Details
#create_tree_entry ⇒ Object
170 171 172 173 174 |
# File 'lib/nodes/stmtnodes.rb', line 170 def create_tree_entry result = set_up_scope_header result += "If statement #{@argument} is used" TREE_ARRAY << result unless TREE_ARRAY[-1] == result end |
#evaluate ⇒ Object
176 177 178 179 180 |
# File 'lib/nodes/stmtnodes.rb', line 176 def evaluate @value = @node.evaluate create_tree_entry if PRINT_TREE_FLAG @value end |
#to_s ⇒ Object
166 167 168 |
# File 'lib/nodes/stmtnodes.rb', line 166 def to_s "If #{argument}" end |