Class: Puppet::Pops::Evaluator::Closure::Named
- Defined in:
- lib/puppet/pops/evaluator/closure.rb
Instance Method Summary collapse
- #closure_name ⇒ Object
-
#enclosing_scope ⇒ Object
The assigned enclosing scope, or global scope if enclosing scope was initialized to nil.
-
#initialize(name, evaluator, model) ⇒ Named
constructor
A new instance of Named.
Constructor Details
#initialize(name, evaluator, model) ⇒ Named
Returns a new instance of Named.
192 193 194 195 |
# File 'lib/puppet/pops/evaluator/closure.rb', line 192 def initialize(name, evaluator, model) @name = name super(evaluator, model) end |
Instance Method Details
#closure_name ⇒ Object
197 198 199 |
# File 'lib/puppet/pops/evaluator/closure.rb', line 197 def closure_name @name end |
#enclosing_scope ⇒ Object
The assigned enclosing scope, or global scope if enclosing scope was initialized to nil
203 204 205 206 207 208 209 210 211 |
# File 'lib/puppet/pops/evaluator/closure.rb', line 203 def enclosing_scope # Named closures are typically used for puppet functions and they cannot be defined # in an enclosing scope as they are cashed and reused. They need to bind to the # global scope at time of use rather at time of definition. # Unnamed closures are always a runtime construct, they are never bound by a loader # and are thus garbage collected at end of a compilation. # Puppet.lookup(:global_scope) { {} } end |