@api private
# File lib/puppet/pops/loader/module_loaders.rb, line 216 def add_to_index(smart_path) found = Dir.glob(File.join(smart_path.generic_path, '**', "*#{smart_path.extension}")) @path_index.merge(found) found end
# File lib/puppet/pops/loader/module_loaders.rb, line 203 def existing_path(effective_path) # Optimized, checks index instead of visiting file system @path_index.include?(effective_path) ? effective_path : nil end
# File lib/puppet/pops/loader/module_loaders.rb, line 222 def get_contents(effective_path) Puppet::FileSystem.read(effective_path) end
# File lib/puppet/pops/loader/module_loaders.rb, line 208 def meaningful_to_search?(smart_path) ! add_to_index(smart_path).empty? end
# File lib/puppet/pops/loader/module_loaders.rb, line 212 def to_s() "(ModuleLoader::FileBased '#{loader_name()}' '#{module_name()}')" end
Create a kind of ModuleLoader for one module (Puppet Module, or module like)
@param parent_loader [Puppet::Pops::Loader::Loader] typically the loader for the environment or root @param module_name [String] the name of the module (non qualified name), may be nil for “modules” only containing globals @param path [String] the path to the root of the module (semantics defined by subclass) @param loader_name [String] a name that identifies the loader
# File lib/puppet/pops/loader/module_loaders.rb, line 198 def initialize(parent_loader, loaders, module_name, path, loader_name) super @path_index = Set.new() end