Class: Puppet::ModuleTool::InstalledModules Private
- Inherits:
-
SemanticPuppet::Dependency::Source
- Object
- SemanticPuppet::Dependency::Source
- Puppet::ModuleTool::InstalledModules
- Defined in:
- lib/puppet/module_tool/installed_modules.rb
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.
Defined Under Namespace
Classes: ModuleRelease
Instance Attribute Summary collapse
- #by_name ⇒ Object readonly private
- #modules ⇒ Object readonly private
Instance Method Summary collapse
-
#fetch(name) ⇒ Array<SemanticPuppet::Dependency::ModuleRelease>
private
Fetches ModuleRelease entries for each release of the named module.
- #fetched ⇒ Object private
-
#initialize(env) ⇒ InstalledModules
constructor
private
A new instance of InstalledModules.
- #priority ⇒ Object private
Constructor Details
#initialize(env) ⇒ InstalledModules
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.
Returns a new instance of InstalledModules.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 16 def initialize(env) @env = env modules = env.modules_by_path @fetched = [] @modules = {} @by_name = {} env.modulepath.each do |path| modules[path].each do |mod| @by_name[mod.name] = mod next unless mod. release = ModuleRelease.new(self, mod) @modules[release.name] ||= release end end @modules.freeze end |
Instance Attribute Details
#by_name ⇒ Object (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.
10 11 12 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 10 def by_name @by_name end |
#modules ⇒ Object (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.
10 11 12 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 10 def modules @modules end |
Instance Method Details
#fetch(name) ⇒ Array<SemanticPuppet::Dependency::ModuleRelease>
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.
Fetches ModuleRelease entries for each release of the named module.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 42 def fetch(name) name = name.tr('/', '-') if @modules.key? name @fetched << name [@modules[name]] else [] end end |
#fetched ⇒ 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.
53 54 55 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 53 def fetched @fetched end |
#priority ⇒ 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.
12 13 14 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 12 def priority 10 end |