Module: Qonfig::Loaders::YAML Private

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

Overview

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

Since:

  • 0.2.0

Class Method Summary collapse

Class Method Details

.load(data) ⇒ 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.

Since:

  • 0.2.0



14
15
16
# File 'lib/qonfig/loaders/yaml.rb', line 14

def load(data)
  ::YAML.load(ERB.new(data).result)
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.

Options Hash (fail_on_unexist:):

  • (Boolean)

Raises:

Since:

  • 0.2.0



26
27
28
29
30
# File 'lib/qonfig/loaders/yaml.rb', line 26

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('{}')
end