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

#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, #existing_path, #get_contents, #meaningful_to_search?

Methods inherited from AbstractPathBasedModuleLoader

#existing_path, #find, #get_contents, #get_source_ref, #global?, #loadables, #meaningful_to_search?

Methods inherited from BaseLoader

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

Methods inherited from Loader

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

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.
    


340
341
342
343
# File 'lib/puppet/pops/loader/module_loaders.rb', line 340

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.



331
332
333
# File 'lib/puppet/pops/loader/module_loaders.rb', line 331

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.



345
346
347
# File 'lib/puppet/pops/loader/module_loaders.rb', line 345

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