Method: Puppet::Pops::Types::ClassLoader.provide_from_name_path
- Defined in:
- lib/puppet/pops/types/class_loader.rb
.provide_from_name_path(name, name_path) ⇒ 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.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/puppet/pops/types/class_loader.rb', line 82 def self.provide_from_name_path(name, name_path) # If class is already loaded, try this first result = find_class(name_path) unless result.is_a?(Module) # Attempt to load it using the auto loader loaded_path = nil if paths_for_name(name_path).find {|path| loaded_path = path; @autoloader.load(path, Puppet.lookup(:current_environment)) } result = find_class(name_path) unless result.is_a?(Module) raise RuntimeError, "Loading of #{name} using relative path: '#{loaded_path}' did not create expected class" end end end return nil unless result.is_a?(Module) result end |