Method: Puppet::Pops::Loader::ModuleLoaders::FileBased#add_to_index

Defined in:
lib/puppet/pops/loader/module_loaders.rb

#add_to_index(smart_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.



474
475
476
477
478
479
480
481
482
483
484
# File 'lib/puppet/pops/loader/module_loaders.rb', line 474

def add_to_index(smart_path)
  found = Dir.glob(File.join(smart_path.generic_path, '**', "*#{smart_path.extension}"))

  # The reason for not always rejecting directories here is performance (avoid extra stat calls). The
  # false positives (directories with a matching extension) is an error in any case and will be caught
  # later.
  found = found.reject { |file_name| File.directory?(file_name) } if smart_path.extension.empty?

  @path_index.merge(found)
  found
end