Class: Facter::Util::FileHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/util/file_helper.rb

Constant Summary collapse

DEBUG_MESSAGE =
'File at: %s is not accessible.'

Class Method Summary collapse

Class Method Details

.safe_read(path, result_if_not_readable = '') ⇒ Object



10
11
12
13
14
# File 'lib/util/file_helper.rb', line 10

def safe_read(path, result_if_not_readable = '')
  return File.read(path) if File.readable?(path)

  result_if_not_readable
end

.safe_readlines(path, result_if_not_readable = []) ⇒ Object



16
17
18
19
20
# File 'lib/util/file_helper.rb', line 16

def safe_readlines(path, result_if_not_readable = [])
  return File.readlines(path) if File.readable?(path)

  result_if_not_readable
end