Method: Puppet::Pops::Loaders.register_runtime3_type

Defined in:
lib/puppet/pops/loaders.rb

.register_runtime3_type(name, origin) ⇒ 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.

Register the given type with the Runtime3TypeLoader. The registration will not happen unless the type system has been initialized.

Parameters:

  • name (String, Symbol)

    the name of the entity being set

  • origin (URI)

    the origin or the source where the type is defined



148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/puppet/pops/loaders.rb', line 148

def self.register_runtime3_type(name, origin)
  loaders = Puppet.lookup(:loaders) { nil }
  return nil if loaders.nil?

  rt3_loader = loaders.runtime3_type_loader
  return nil if rt3_loader.nil?

  name = name.to_s
  caps_name = Types::TypeFormatter.singleton.capitalize_segments(name)
  typed_name = Loader::TypedName.new(:type, name)
  rt3_loader.set_entry(typed_name, Types::PResourceType.new(caps_name), origin)
  nil
end