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

Returns a new instance of IfCompStmtNode.



229
230
231
# File 'lib/nodes/stmtnodes.rb', line 229

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

Instance Method Details

#evaluateObject



233
234
235
236
237
238
239
240
# File 'lib/nodes/stmtnodes.rb', line 233

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