Class: Nonnative::ConfigurationFile

Inherits:
Object
  • Object
show all
Defined in:
lib/nonnative/configuration_file.rb

Overview

Safely loads a YAML configuration file into the Config::Options shape used by Nonnative.

Class Method Summary collapse

Class Method Details

.load(path) ⇒ Config::Options

Loads a file into a Config::Options instance.

YAML files are parsed as data only: ERB is not evaluated and arbitrary object deserialization is not allowed.

Parameters:

  • path (String)

    file path

Returns:

  • (Config::Options)


13
14
15
16
17
18
# File 'lib/nonnative/configuration_file.rb', line 13

def load(path)
  Config::Options.new.tap do |config|
    config.add_source!(safe_load_yaml(path))
    config.load!
  end
end