Class: IfCompStmtNode

Inherits:
Node
  • Object
show all
Defined in:
lib/nodes/stmtnodes.rb

Instance Attribute Summary

Attributes inherited from Node

#value

Instance Method Summary collapse

Methods inherited from Node

#to_s

Constructor Details

#initialize(*nodes) ⇒ IfCompStmtNode



142
143
144
# File 'lib/nodes/stmtnodes.rb', line 142

def initialize(*nodes)
  @nodes = nodes.flatten
end

Instance Method Details

#evaluateObject



146
147
148
149
150
151
152
153
# File 'lib/nodes/stmtnodes.rb', line 146

def evaluate
  @nodes.each do |node|
    if node.argument.evaluate
      return node.evaluate
    end
  end
  return nil
end