class Puppet::Settings::FileOrDirectorySetting

Public Instance Methods

munge(value) click to toggle source

Overrides munge to be able to read the un-munged value (the FileSetting.munch removes trailing slash)

# File lib/puppet/settings/file_or_directory_setting.rb, line 17
def munge(value)
  if value.is_a?(String) && value =~ /[\\/]$/
    @path_ends_with_slash = true
  end
  super
end
open_file(filename, option = 'r', &block) click to toggle source

@api private

# File lib/puppet/settings/file_or_directory_setting.rb, line 25
def open_file(filename, option = 'r', &block)
  if type == :file
    super
  else
    controlled_access do |mode|
      Puppet::FileSystem.open(filename, mode, option, &block)
    end
  end
end
type() click to toggle source
# File lib/puppet/settings/file_or_directory_setting.rb, line 7
def type
  if Puppet::FileSystem.directory?(self.value) || @path_ends_with_slash
    :directory
  else
    :file
  end
end

Public Class Methods

new(args) click to toggle source
# File lib/puppet/settings/file_or_directory_setting.rb, line 3
def initialize(args)
  super
end