Class: Puppet::Pops::Loader::LoaderPaths::SmartPaths
- Defined in:
- lib/puppet/pops/loader/loader_paths.rb
Overview
SmartPaths
Holds effective SmartPath instances per type
Instance Method Summary collapse
-
#effective_paths(type) ⇒ Array<SmartPath>
Ensures that the paths for the type have been probed and pruned to what is existing relative to the given root.
-
#initialize(path_based_loader) ⇒ SmartPaths
constructor
A new instance of SmartPaths.
Constructor Details
#initialize(path_based_loader) ⇒ SmartPaths
Returns a new instance of SmartPaths.
201 202 203 204 |
# File 'lib/puppet/pops/loader/loader_paths.rb', line 201 def initialize(path_based_loader) @loader = path_based_loader @smart_paths = {} end |
Instance Method Details
#effective_paths(type) ⇒ Array<SmartPath>
Ensures that the paths for the type have been probed and pruned to what is existing relative to the given root.
212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/puppet/pops/loader/loader_paths.rb', line 212 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 |