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 4 def initialize(args) 5 super 6 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 18 def munge(value) 19 if value.is_a?(String) && value =~ /[\\\/]$/ 20 @path_ends_with_slash = true 21 end 22 super 23 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 32 def open_file(filename, option = 'r', &block) 33 if type == :file 34 super 35 else 36 controlled_access do |mode| 37 Puppet::FileSystem.open(filename, mode, option, &block) 38 end 39 end 40 end
type()
click to toggle source
# File lib/puppet/settings/file_or_directory_setting.rb 8 def type 9 if Puppet::FileSystem.directory?(self.value) || @path_ends_with_slash 10 :directory 11 else 12 :file 13 end 14 end