Class: Puppet::Plugins::DataProviders::ResolvedPath Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/plugins/data_providers/data_provider.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.

Class that keeps track of the original path (as it appears in the declaration, before interpolation), the fully resolved path, and whether or the resolved path exists.

Since:

  • Puppet 4.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_path, path) ⇒ ResolvedPath

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

Parameters:

  • original_path (String)

    path as found in declaration. May contain interpolation expressions

  • path (Pathname)

    the expanded absolute path

Since:

  • Puppet 4.0.0



153
154
155
156
157
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 153

def initialize(original_path, path)
  @original_path = original_path
  @path = path
  @exists = nil
end

Instance Attribute Details

#original_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.

Since:

  • Puppet 4.0.0



149
150
151
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 149

def original_path
  @original_path
end

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

Since:

  • Puppet 4.0.0



149
150
151
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 149

def path
  @path
end

Instance Method Details

#exists?Boolean

Returns cached info if the path exists or not.

Returns:

  • (Boolean)

    cached info if the path exists or not

Since:

  • Puppet 4.0.0



161
162
163
164
# File 'lib/puppet/plugins/data_providers/data_provider.rb', line 161

def exists?
  @exists = @path.exist? if @exists.nil?
  @exists
end