Module: Puppet::Pops::Loader::LoaderPaths

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

Overview

LoaderPaths

The central loader knowledge about paths, what they represent and how to instantiate from them. Contains helpers (*smart paths*) to deal with lazy resolution of paths.

TODO: Currently only supports loading of functions (2 kinds)

Defined Under Namespace

Classes: FunctionPath3x, FunctionPath4x, FunctionPathPP, PuppetSmartPath, ResourceTypeImplPP, RubySmartPath, SmartPath, SmartPaths, TypePathPP

Class Method Summary collapse

Class Method Details

.relative_paths_for_type(type, loader) ⇒ Object

Returns an array of SmartPath, each instantiated with a reference to the given loader (for root path resolution and existence checks). The smart paths in the array appear in precedence order. The returned array may be mutated.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/puppet/pops/loader/loader_paths.rb', line 14

def self.relative_paths_for_type(type, loader)
  result = []
  case type
  when :function
      # Only include support for the loadable items the loader states it can contain
      if loader.loadables.include?(:func_4x)
        result << FunctionPath4x.new(loader)
      end
      if loader.loadables.include?(:func_4xpp)
        result << FunctionPathPP.new(loader)
      end
      # When wanted also add FunctionPath3x to load 3x functions
  when :type
    result << TypePathPP.new(loader) if loader.loadables.include?(:type_pp)
  when :resource_type_pp
    result << ResourceTypeImplPP.new(loader) if loader.loadables.include?(:resource_type_pp)
  else
    # unknown types, simply produce an empty result; no paths to check, nothing to find... move along...
    []
  end
  result
end