class Puppet::Pops::Lookup::FunctionContext
A FunctionContext
is created for each unique hierarchy entry and adapted to the Compiler (and hence shares the compiler's life-cycle). @api private
Attributes
data_hash[RW]
function[R]
module_name[R]
Public Class Methods
new(environment_context, module_name, function)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 68 def initialize(environment_context, module_name, function) 69 @data_hash = nil 70 @cache = {} 71 @environment_context = environment_context 72 @module_name = module_name 73 @function = function 74 end
Public Instance Methods
cache(key, value)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 76 def cache(key, value) 77 @cache[key] = value 78 end
cache_all(hash)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 80 def cache_all(hash) 81 @cache.merge!(hash) 82 nil 83 end
cache_has_key(key)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 85 def cache_has_key(key) 86 @cache.include?(key) 87 end
cached_entries() { |*next| ... }
click to toggle source
# File lib/puppet/pops/lookup/context.rb 93 def cached_entries(&block) 94 if block_given? 95 enumerator = @cache.each_pair 96 @cache.size.times do 97 if block.arity == 2 98 yield(*enumerator.next) 99 else 100 yield(enumerator.next) 101 end 102 end 103 nil 104 else 105 Types::Iterable.on(@cache) 106 end 107 end
cached_file_data(path, &block)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 109 def cached_file_data(path, &block) 110 @environment_context.cached_file_data(path, &block) 111 end
cached_value(key)
click to toggle source
# File lib/puppet/pops/lookup/context.rb 89 def cached_value(key) 90 @cache[key] 91 end
environment_name()
click to toggle source
# File lib/puppet/pops/lookup/context.rb 113 def environment_name 114 @environment_context.environment_name 115 end