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.
69 70 71 72 73 74 75 |
# File 'lib/puppet/pops/lookup/context.rb', line 69 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.
67 68 69 |
# File 'lib/puppet/pops/lookup/context.rb', line 67 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.
66 67 68 |
# File 'lib/puppet/pops/lookup/context.rb', line 66 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.
66 67 68 |
# File 'lib/puppet/pops/lookup/context.rb', line 66 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.
77 78 79 |
# File 'lib/puppet/pops/lookup/context.rb', line 77 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.
81 82 83 84 |
# File 'lib/puppet/pops/lookup/context.rb', line 81 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.
86 87 88 |
# File 'lib/puppet/pops/lookup/context.rb', line 86 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.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/puppet/pops/lookup/context.rb', line 94 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.
109 110 111 |
# File 'lib/puppet/pops/lookup/context.rb', line 109 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.
90 91 92 |
# File 'lib/puppet/pops/lookup/context.rb', line 90 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.
113 114 115 |
# File 'lib/puppet/pops/lookup/context.rb', line 113 def environment_name @environment_context.environment_name end |