Class: Puppet::Pops::Loader::Runtime3TypeLoader Private
- Inherits:
-
BaseLoader
- Object
- Loader
- BaseLoader
- Puppet::Pops::Loader::Runtime3TypeLoader
- Defined in:
- lib/puppet/pops/loader/runtime3_type_loader.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.
Runtime3TypeLoader
Loads a resource type using the 3.x type loader
Constant Summary
Constants inherited from Loader
Instance Attribute Summary
Attributes inherited from BaseLoader
Attributes inherited from Loader
Instance Method Summary collapse
-
#allow_shadowing? ⇒ Boolean
private
Allows shadowing since this loader is populalted with all loaded resource types at time of loading.
-
#find(typed_name) ⇒ Loader::NamedEntry, ...
private
Finds typed/named entity in this module.
-
#initialize(parent_loader, loaders, environment, env_path) ⇒ Runtime3TypeLoader
constructor
private
A new instance of Runtime3TypeLoader.
- #to_s ⇒ Object private
Methods inherited from BaseLoader
#add_entry, #get_entry, #load_typed, #loaded_entry, #promote_entry, #remove_entry, #set_entry
Methods inherited from Loader
#[], #get_entry, #inspect, #load, #load_typed, #loadables, #loaded_entry, #parent, #private_loader, #set_entry
Constructor Details
#initialize(parent_loader, loaders, environment, env_path) ⇒ Runtime3TypeLoader
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 Runtime3TypeLoader.
10 11 12 13 14 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 10 def initialize(parent_loader, loaders, environment, env_path) super(parent_loader, environment.name) @environment = environment @resource_3x_loader = env_path.nil? ? nil : ModuleLoaders.pcore_resource_type_loader_from(parent_loader, loaders, env_path) end |
Instance Method Details
#allow_shadowing? ⇒ Boolean
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.
Allows shadowing since this loader is populalted with all loaded resource types at time of loading. This loading will, for built in types override the aliases configured in the static loader.
90 91 92 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 90 def allow_shadowing? true end |
#find(typed_name) ⇒ Loader::NamedEntry, ...
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.
Finds typed/named entity in this module
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 24 def find(typed_name) return nil unless typed_name. == Pcore::RUNTIME_NAME_AUTHORITY case typed_name.type when :type value = nil name = typed_name.name if @resource_3x_loader.nil? value = Puppet::Type.type(name) unless typed_name.qualified? if value.nil? # Look for a user defined type value = @environment.known_resource_types.find_definition(name) end else impl_te = find_impl(TypedName.new(:resource_type_pp, name, typed_name.)) value = impl_te.value unless impl_te.nil? end if value.nil? # Cache the fact that it wasn't found set_entry(typed_name, nil) return nil end # Loaded types doesn't have the same life cycle as this loader, so we must start by # checking if the type was created. If it was, an entry will already be stored in # this loader. If not, then it was created before this loader was instantiated and # we must therefore add it. te = get_entry(typed_name) te = set_entry(typed_name, Types::TypeFactory.resource(value.name.to_s)) if te.nil? || te.value.nil? te when :resource_type_pp @resource_3x_loader.nil? ? nil : find_impl(typed_name) else nil end end |
#to_s ⇒ 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.
16 17 18 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 16 def to_s() "(Runtime3TypeLoader '#{loader_name()}')" end |