class Puppet::Pops::Loader::LoaderPaths::SmartPaths

SmartPaths

Holds effective SmartPath instances per type

Public Instance Methods

effective_paths(type) click to toggle source

Ensures that the paths for the type have been probed and pruned to what is existing relative to the given root.

@param type [Symbol] the entity type to load @return [Array<SmartPath>] array of effective paths for type (may be empty)

# File lib/puppet/pops/loader/loader_paths.rb, line 105
def effective_paths(type)
  smart_paths = @smart_paths
  loader = @loader
  unless effective_paths = smart_paths[type]
    # type not yet processed, does the various directories for the type exist ?
    # Get the relative dirs for the type
    paths_for_type = Puppet::Pops::Loader::LoaderPaths.relative_paths_for_type(type, loader)
    # Check which directories exist in the loader's content/index
    effective_paths = smart_paths[type] = paths_for_type.select { |sp| loader.meaningful_to_search?(sp) }
  end
  effective_paths
end

Public Class Methods

new(path_based_loader) click to toggle source
# File lib/puppet/pops/loader/loader_paths.rb, line 94
def initialize(path_based_loader)
  @loader = path_based_loader
  @smart_paths = {}
end