Class: Puppet::Pops::Evaluator::Closure::Dynamic

Inherits:
Closure
  • Object
show all
Defined in:
lib/puppet/pops/evaluator/closure.rb

Instance Method Summary collapse

Constructor Details

#initialize(evaluator, model, scope) ⇒ Dynamic

Returns a new instance of Dynamic.



171
172
173
174
# File 'lib/puppet/pops/evaluator/closure.rb', line 171

def initialize(evaluator, model, scope)
  @enclosing_scope = scope
  super(evaluator, model)
end

Instance Method Details

#call(*args) ⇒ Object



180
181
182
183
184
185
186
187
188
# File 'lib/puppet/pops/evaluator/closure.rb', line 180

def call(*args)
  # A return from an unnamed closure is treated as a return from the context evaluating
  # calling this closure - that is, as if it was the return call itself.
  #
  jumper = catch(:return) do
    return call_with_scope(enclosing_scope, args)
  end
  raise jumper
end

#enclosing_scopeObject



176
177
178
# File 'lib/puppet/pops/evaluator/closure.rb', line 176

def enclosing_scope
  @enclosing_scope
end