class Facter::Util::FileHelper
Constants
- DEBUG_MESSAGE
Public Class Methods
Source
# File lib/facter/util/file_helper.rb, line 31 def dir_children(path) Dir.children(path) end
Source
# File lib/facter/util/file_helper.rb, line 11 def safe_read(path, default_return = '') return File.read(path, encoding: Encoding::UTF_8) if File.readable?(path) log_failed_to_read(path) default_return end
Source
# File lib/facter/util/file_helper.rb, line 19 def safe_readlines(path, default_return = [], sep = $/, chomp: false) return File.readlines(path, sep, chomp: chomp, encoding: Encoding::UTF_8) if File.readable?(path) log_failed_to_read(path) default_return end
rubocop:disable Style/SpecialGlobalVars
Private Class Methods
Source
# File lib/facter/util/file_helper.rb, line 37 def log_failed_to_read(path) @log.debug(DEBUG_MESSAGE % path) end