Class: Puppet::Pops::Loader::LoaderPaths::SmartPath

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/loader/loader_paths.rb

Overview

# DO NOT REMOVE YET. needed later? when there is the need to decamel a classname

def de_camel(fq_name)
  fq_name.to_s.gsub(/::/, '/').
  gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
  gsub(/([a-z\d])([A-Z])/,'\1_\2').
  tr("-", "_").
  downcase
end

Direct Known Subclasses

PuppetSmartPath, RubySmartPath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(loader) ⇒ SmartPath

Creates SmartPath for the given loader (loader knows how to check for existence etc.)



49
50
51
# File 'lib/puppet/pops/loader/loader_paths.rb', line 49

def initialize(loader)
  @loader = loader
end

Instance Attribute Details

#generic_pathObject (readonly)

Generic path, in the sense of “if there are any entities of this kind to load, where are they?”



46
47
48
# File 'lib/puppet/pops/loader/loader_paths.rb', line 46

def generic_path
  @generic_path
end

Instance Method Details

#effective_path(typed_name, start_index_in_name) ⇒ Object

Effective path is the generic path + the name part(s) + extension.



66
67
68
# File 'lib/puppet/pops/loader/loader_paths.rb', line 66

def effective_path(typed_name, start_index_in_name)
  "#{File.join(generic_path, typed_name.name_parts)}#{extension}"
end

#instantiatorObject

Raises:

  • (NotImplementedError)


74
75
76
# File 'lib/puppet/pops/loader/loader_paths.rb', line 74

def instantiator()
  raise NotImplementedError.new
end

#relative_pathObject

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/puppet/pops/loader/loader_paths.rb', line 70

def relative_path()
  raise NotImplementedError.new
end

#root_pathObject



60
61
62
# File 'lib/puppet/pops/loader/loader_paths.rb', line 60

def root_path
  @loader.path
end