Class: FunctiondefNode
- Inherits:
-
Object
- Object
- FunctiondefNode
- Defined in:
- lib/nodes.rb
Instance Method Summary collapse
- #evaluate(scope) ⇒ Object
-
#initialize(identifier, block, parameters = []) ⇒ FunctiondefNode
constructor
A new instance of FunctiondefNode.
Constructor Details
#initialize(identifier, block, parameters = []) ⇒ FunctiondefNode
Returns a new instance of FunctiondefNode.
89 90 91 92 93 |
# File 'lib/nodes.rb', line 89 def initialize(identifier, block, parameters = []) @identifier = identifier.value @parameters = parameters @block = block end |
Instance Method Details
#evaluate(scope) ⇒ Object
95 96 97 98 |
# File 'lib/nodes.rb', line 95 def evaluate(scope) params = @parameters.map {|parameter| parameter.value} scope.set_function(@identifier, @block, params) end |