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