class Puppet::Settings::FileOrDirectorySetting
Public Class Methods
new(args)
click to toggle source
Calls superclass method
Puppet::Settings::FileSetting::new
# File lib/puppet/settings/file_or_directory_setting.rb 3 def initialize(args) 4 super 5 end
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)
Calls superclass method
Puppet::Settings::FileSetting#munge
# File lib/puppet/settings/file_or_directory_setting.rb 17 def munge(value) 18 if value.is_a?(String) && value =~ /[\\\/]$/ 19 @path_ends_with_slash = true 20 end 21 super 22 end
open_file(filename, option = 'r', &block)
click to toggle source
@api private
@param option [String] Extra file operation mode information to use
(defaults to read-only mode 'r') This is the standard mechanism Ruby uses in the IO class, and therefore encoding may be explicitly like fmode : encoding or fmode : "BOM|UTF-*" for example, a:ASCII or w+:UTF-8
Calls superclass method
Puppet::Util::Windows::Security#open_file
# File lib/puppet/settings/file_or_directory_setting.rb 31 def open_file(filename, option = 'r', &block) 32 if type == :file 33 super 34 else 35 controlled_access do |mode| 36 Puppet::FileSystem.open(filename, mode, option, &block) 37 end 38 end 39 end
type()
click to toggle source
# File lib/puppet/settings/file_or_directory_setting.rb 7 def type 8 if Puppet::FileSystem.directory?(self.value) || @path_ends_with_slash 9 :directory 10 else 11 :file 12 end 13 end