Class: Puppet::Pops::Loader::ModuleLoaders::GemBased Private

Inherits:
FileBased show all
Includes:
GemSupport
Defined in:
lib/puppet/pops/loader/module_loaders.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.

Loads from a gem specified as a URI, gem://gemname/optional/path/in/gem, or just a String gemname. The source reference (shown in errors etc.) is the expanded path of the gem as this is believed to be more helpful - given the location it should be quite obvious which gem it is, without the location, the user would need to go on a hunt for where the file actually is located.

TODO: How does this get instantiated? Does the gemname refelect the name of the module (the namespace)

or is that specified a different way? Can a gem be the container of multiple modules?

Constant Summary

Constants inherited from Loader

Loader::LOADABLE_KINDS

Instance Attribute Summary collapse

Attributes inherited from FileBased

#path_index, #smart_paths

Attributes inherited from AbstractPathBasedModuleLoader

#module_name, #path, #private_loader, #smart_paths

Attributes inherited from BaseLoader

#parent

Attributes inherited from Loader

#environment, #loader_name

Instance Method Summary collapse

Methods included from GemSupport

#gem_dir, #gem_dir_from_name, #gem_dir_from_uri

Methods inherited from FileBased

#add_to_index, #candidate_paths, #existing_path, #get_contents, #meaningful_to_search?, #relative_paths

Methods inherited from AbstractPathBasedModuleLoader

#candidate_paths, #discover, #existing_path, #find, #get_contents, #get_source_ref, #global?, #instantiate, #lib_root?, #loadables, #meaningful_to_search?, #relative_paths

Methods inherited from BaseLoader

#add_entry, #discover, #get_entry, #load_typed, #loaded_entry, #promote_entry, #remove_entry, #set_entry

Methods inherited from Loader

#[], #discover, #find, #get_entry, #inspect, #load, #load_typed, #loadables, #loaded_entry, #parent, #private_loader, #set_entry, #synchronize

Constructor Details

#initialize(parent_loader, loaders, module_name, gem_ref, loader_name, loadables = LOADABLE_KINDS) ⇒ GemBased

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.

Create a kind of ModuleLoader for one module The parameters are:

  • parent_loader - typically the loader for the root

  • module_name - the name of the module (non qualified name)

  • gem_ref - [URI, String] gem reference to the root of the module (URI, gem://gemname/optional/path/in/gem), or

    just the gem's name as a String.
    


541
542
543
544
# File 'lib/puppet/pops/loader/module_loaders.rb', line 541

def initialize(parent_loader, loaders, module_name, gem_ref, loader_name, loadables = LOADABLE_KINDS)
  @gem_ref = gem_ref
  super parent_loader, loaders, module_name, gem_dir(gem_ref), loader_name, loadables
end

Instance Attribute Details

#gem_refObject (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.



532
533
534
# File 'lib/puppet/pops/loader/module_loaders.rb', line 532

def gem_ref
  @gem_ref
end

Instance Method Details

#to_sObject

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.



546
547
548
# File 'lib/puppet/pops/loader/module_loaders.rb', line 546

def to_s
  "(ModuleLoader::GemBased '#{loader_name}' '#{@gem_ref}' [#{module_name}])"
end