Class: BlockNode
- Inherits:
-
Object
- Object
- BlockNode
- Defined in:
- lib/nodes.rb
Instance Method Summary collapse
- #evaluate(scope) ⇒ Object
-
#initialize(statements = nil) ⇒ BlockNode
constructor
A new instance of BlockNode.
Constructor Details
#initialize(statements = nil) ⇒ BlockNode
Returns a new instance of BlockNode.
73 74 75 |
# File 'lib/nodes.rb', line 73 def initialize(statements = nil) @block = statements end |
Instance Method Details
#evaluate(scope) ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/nodes.rb', line 77 def evaluate(scope) return unless @block result = nil @block.each do |statement| result = statement.evaluate(scope) return result if result.is_a?(ReturnValue) end return result end |