Method: Facter::Util::FileHelper.safe_readlines

Defined in:
lib/facter/util/file_helper.rb

.safe_readlines(path, default_return = [], sep = $/, chomp: false) ⇒ Object

rubocop:disable Style/SpecialGlobalVars



19
20
21
22
23
24
# 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