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

SmartPaths

Holds effective SmartPath instances per type

Public Class Methods

new(path_based_loader) click to toggle source
    # File lib/puppet/pops/loader/loader_paths.rb
385 def initialize(path_based_loader)
386   @loader = path_based_loader
387   @smart_paths = {}
388 end

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
396 def effective_paths(type)
397   smart_paths = @smart_paths
398   loader = @loader
399   effective_paths = smart_paths[type]
400   unless effective_paths
401     # type not yet processed, does the various directories for the type exist ?
402     # Get the relative dirs for the type
403     paths_for_type = LoaderPaths.relative_paths_for_type(type, loader)
404     # Check which directories exist in the loader's content/index
405     effective_paths = smart_paths[type] = paths_for_type.select { |sp| loader.meaningful_to_search?(sp) }
406   end
407   effective_paths
408 end