Class: Puppet::Parser::Functions::AnonymousModuleAdapter Private

Inherits:
Puppet::Pops::Adaptable::Adapter show all
Defined in:
lib/puppet/parser/functions.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.

An adapter that ties the anonymous module that acts as the container for all 3x functions to the environment where the functions are created. This adapter ensures that the life-cycle of those functions doesn’t exceed the life-cycle of the environment.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Puppet::Pops::Adaptable::Adapter

adapt, adapt_new, associate_adapter, clear, get, instance_var_name, self_attr_name, type_name

Instance Attribute Details

#moduleObject

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
# File 'lib/puppet/parser/functions.rb', line 81

def module
  @module
end

Class Method Details

.create_adapter(env) ⇒ 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.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/puppet/parser/functions.rb', line 83

def self.create_adapter(env)
  adapter = super(env)
  adapter.module = Module.new do
    @metadata = {}

    def self.all_function_info
      @metadata
    end

    def self.get_function_info(name)
      @metadata[name]
    end

    def self.add_function_info(name, info)
      @metadata[name] = info
    end
  end
  adapter
end