Class: PuppetX::Puppetlabs::Registry::RegistryPathBase Private

Inherits:
String
  • Object
show all
Defined in:
lib/puppet_x/puppetlabs/registry.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This is the base class for Path manipulation. This class is meant to be abstract, RegistryKeyPath and RegistryValuePath will customize and override this class.

Direct Known Subclasses

RegistryKeyPath, RegistryValuePath

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ RegistryPathBase

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RegistryPathBase.



56
57
58
59
60
# File 'lib/puppet_x/puppetlabs/registry.rb', line 56

def initialize(path)
  @filter_path_memo = nil
  @path ||= path
  super(path)
end

Instance Attribute Details

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
# File 'lib/puppet_x/puppetlabs/registry.rb', line 54

def path
  @path
end

Instance Method Details

#accessObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



80
81
82
# File 'lib/puppet_x/puppetlabs/registry.rb', line 80

def access
  filter_path[:access]
end

#aliasesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method is meant to help setup aliases so autorequire can sort itself out in a case insensitive but preserving manner. It returns an array of resource identifiers.



76
77
78
# File 'lib/puppet_x/puppetlabs/registry.rb', line 76

def aliases
  [canonical.downcase]
end

#ascendObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



92
93
94
95
96
97
98
# File 'lib/puppet_x/puppetlabs/registry.rb', line 92

def ascend
  p = canonical
  while idx = p.rindex('\\') # rubocop:disable Lint/AssignmentInCondition
    p = p[0, idx]
    yield p
  end
end

#canonicalObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



69
70
71
# File 'lib/puppet_x/puppetlabs/registry.rb', line 69

def canonical
  filter_path[:canonical]
end

#rootObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



84
85
86
# File 'lib/puppet_x/puppetlabs/registry.rb', line 84

def root
  filter_path[:root]
end

#subkeyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



88
89
90
# File 'lib/puppet_x/puppetlabs/registry.rb', line 88

def subkey
  filter_path[:trailing_path]
end

#valid?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The path is valid if we’re able to parse it without exceptions.

Returns:

  • (Boolean)


63
64
65
66
67
# File 'lib/puppet_x/puppetlabs/registry.rb', line 63

def valid?
  (filter_path && true)
rescue StandardError
  false
end