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.)



51
52
53
# File 'lib/puppet/pops/loader/loader_paths.rb', line 51

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?”



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

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.



68
69
70
# File 'lib/puppet/pops/loader/loader_paths.rb', line 68

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

#instantiatorObject

Raises:

  • (NotImplementedError)


76
77
78
# File 'lib/puppet/pops/loader/loader_paths.rb', line 76

def instantiator()
  raise NotImplementedError.new
end

#relative_pathObject

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/puppet/pops/loader/loader_paths.rb', line 72

def relative_path()
  raise NotImplementedError.new
end

#root_pathObject



62
63
64
# File 'lib/puppet/pops/loader/loader_paths.rb', line 62

def root_path
  @loader.path
end