Method: Puppet::Pops::Loaders#find_loader

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

#find_loader(module_name) ⇒ Loader::Loader

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 the appropriate loader for the given ‘module_name`, or for the environment in case `module_name` is `nil` or empty.

Parameters:

  • module_name (String, nil)

    the name of the module

Returns:

Raises:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/puppet/pops/loaders.rb', line 207

def find_loader(module_name)
  if module_name.nil? || EMPTY_STRING == module_name
    # Use the public environment loader
    public_environment_loader
  else
    # TODO : Later check if definition is private, and then add it to private_loader_for_module
    #
    loader = public_loader_for_module(module_name)
    if loader.nil?
      raise Puppet::ParseError, _("Internal Error: did not find public loader for module: '%{module_name}'") % { module_name: module_name }
    end
    loader
  end
end