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
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.
Constant Summary
Constants inherited from Loader
Instance Attribute Summary collapse
- #resource_3x_loader ⇒ Object readonly private
Attributes inherited from BaseLoader
Attributes inherited from Loader
Instance Method Summary collapse
-
#allow_shadowing? ⇒ Boolean
private
Allows shadowing since this loader is populated with all loaded resource types at time of loading.
- #discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block) ⇒ Object private
-
#find(typed_name) ⇒ Loader::NamedEntry, ...
private
Finds typed/named entity in this module.
-
#initialize(parent_loader, loaders, environment, resource_3x_loader) ⇒ 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, #synchronize
Constructor Details
#initialize(parent_loader, loaders, environment, resource_3x_loader) ⇒ 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.
13 14 15 16 17 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 13 def initialize(parent_loader, loaders, environment, resource_3x_loader) super(parent_loader, environment.name, environment) @environment = environment @resource_3x_loader = resource_3x_loader end |
Instance Attribute Details
#resource_3x_loader ⇒ 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.
11 12 13 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 11 def resource_3x_loader @resource_3x_loader 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 populated with all loaded resource types at time of loading. This loading will, for built in types override the aliases configured in the static loader.
99 100 101 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 99 def allow_shadowing? true end |
#discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &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.
19 20 21 22 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 19 def discover(type, error_collector = nil, = Pcore::RUNTIME_NAME_AUTHORITY, &block) # TODO: Use generated index of all known types (requires separate utility). parent.discover(type, error_collector, , &block) 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
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 60 61 62 63 64 65 66 67 68 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 32 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.
24 25 26 |
# File 'lib/puppet/pops/loader/runtime3_type_loader.rb', line 24 def to_s "(Runtime3TypeLoader '#{loader_name()}')" end |