Method: Qonfig::Loaders::Basic.load_file

Defined in:
lib/qonfig/loaders/basic.rb

.load_file(file_path, fail_on_unexist: true) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • file_path (String, Pathname)
  • fail_on_unexist (Hash) (defaults to: true)

    a customizable set of options

Options Hash (fail_on_unexist:):

  • (Boolean)

Returns:

  • (Object)

Raises:

Since:

  • 0.5.0



33
34
35
36
37
# File 'lib/qonfig/loaders/basic.rb', line 33

def load_file(file_path, fail_on_unexist: true)
  load(::File.read(file_path))
rescue Errno::ENOENT => error
  fail_on_unexist ? (raise Qonfig::FileNotFoundError, error.message) : load_empty_data
end