Class: Puppet::Pops::Lookup::FunctionContext Private
- Includes:
- Interpolation
- Defined in:
- lib/puppet/pops/lookup/context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants included from SubLookup
Instance Attribute Summary collapse
- #data_hash ⇒ Object private
- #environment_name ⇒ Object readonly private
- #function ⇒ Object readonly private
- #module_name ⇒ Object readonly private
Instance Method Summary collapse
- #cache(key, value) ⇒ Object private
- #cache_all(hash) ⇒ Object private
- #cache_has_key(key) ⇒ Object private
- #cached_entries(&block) ⇒ Object private
- #cached_value(key) ⇒ Object private
-
#initialize(environment_name, module_name, function) ⇒ FunctionContext
constructor
private
A new instance of FunctionContext.
Methods included from Interpolation
Methods included from SubLookup
Constructor Details
#initialize(environment_name, module_name, function) ⇒ FunctionContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of FunctionContext.
14 15 16 17 18 19 20 |
# File 'lib/puppet/pops/lookup/context.rb', line 14 def initialize(environment_name, module_name, function) @data_hash = nil @cache = {} @environment_name = environment_name @module_name = module_name @function = function end |
Instance Attribute Details
#data_hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/puppet/pops/lookup/context.rb', line 12 def data_hash @data_hash end |
#environment_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/puppet/pops/lookup/context.rb', line 11 def environment_name @environment_name end |
#function ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/puppet/pops/lookup/context.rb', line 11 def function @function end |
#module_name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/puppet/pops/lookup/context.rb', line 11 def module_name @module_name end |
Instance Method Details
#cache(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/puppet/pops/lookup/context.rb', line 22 def cache(key, value) @cache[key] = value end |
#cache_all(hash) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 |
# File 'lib/puppet/pops/lookup/context.rb', line 26 def cache_all(hash) @cache.merge!(hash) nil end |
#cache_has_key(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/puppet/pops/lookup/context.rb', line 31 def cache_has_key(key) @cache.include?(key) end |
#cached_entries(&block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet/pops/lookup/context.rb', line 39 def cached_entries(&block) if block_given? enumerator = @cache.each_pair @cache.size.times do if block.arity == 2 yield(*enumerator.next) else yield(enumerator.next) end end nil else Types::Iterable.on(@cache) end end |
#cached_value(key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/puppet/pops/lookup/context.rb', line 35 def cached_value(key) @cache[key] end |