Class: Qonfig::Loaders::Basic Private

Inherits:
Object
  • Object
show all
Defined in:
lib/qonfig/loaders/basic.rb

Overview

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

rubocop:disable Style/StaticClass

Since:

  • 0.2.0

Direct Known Subclasses

Dynamic, JSON, TOML, Vault, YAML

Class Method Summary collapse

Class Method Details

.load(data) ⇒ void

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.

This method returns an undefined value.

Parameters:

  • data (String)

Since:

  • 0.5.0



13
14
15
# File 'lib/qonfig/loaders/basic.rb', line 13

def load(data)
  nil # NOTE: consciously return nil (for clarity)
end

.load_empty_datavoid

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.

This method returns an undefined value.

Since:

  • 0.5.0



21
22
23
# File 'lib/qonfig/loaders/basic.rb', line 21

def load_empty_data
  nil # NOTE: consciously return nil (for clarity)
end

.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