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.
A FunctionContext is created for each unique hierarchy entry and adapted to the Compiler (and hence shares the compiler’s life-cycle).
Constant Summary
Constants included from SubLookup
Instance Attribute Summary collapse
- #data_hash ⇒ Object 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_file_data(path, &block) ⇒ Object private
- #cached_value(key) ⇒ Object private
- #environment_name ⇒ Object private
-
#initialize(environment_context, module_name, function) ⇒ FunctionContext
constructor
private
A new instance of FunctionContext.
Methods included from Interpolation
Methods included from SubLookup
Constructor Details
#initialize(environment_context, 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.
70 71 72 73 74 75 76 |
# File 'lib/puppet/pops/lookup/context.rb', line 70 def initialize(environment_context, module_name, function) @data_hash = nil @cache = {} @environment_context = environment_context @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.
68 69 70 |
# File 'lib/puppet/pops/lookup/context.rb', line 68 def data_hash @data_hash 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.
67 68 69 |
# File 'lib/puppet/pops/lookup/context.rb', line 67 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.
67 68 69 |
# File 'lib/puppet/pops/lookup/context.rb', line 67 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.
78 79 80 |
# File 'lib/puppet/pops/lookup/context.rb', line 78 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.
82 83 84 85 |
# File 'lib/puppet/pops/lookup/context.rb', line 82 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.
87 88 89 |
# File 'lib/puppet/pops/lookup/context.rb', line 87 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.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/puppet/pops/lookup/context.rb', line 95 def cached_entries(&block) if block_given? @cache.each_pair do |pair| if block.arity == 2 yield(*pair) else yield(pair) end end nil else Types::Iterable.on(@cache) end end |
#cached_file_data(path, &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.
110 111 112 |
# File 'lib/puppet/pops/lookup/context.rb', line 110 def cached_file_data(path, &block) @environment_context.cached_file_data(path, &block) 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.
91 92 93 |
# File 'lib/puppet/pops/lookup/context.rb', line 91 def cached_value(key) @cache[key] end |
#environment_name ⇒ 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.
114 115 116 |
# File 'lib/puppet/pops/lookup/context.rb', line 114 def environment_name @environment_context.environment_name end |