module Settings

Settings::Config is a module that provides agile way to work with configuration, which can be useful for object initialization with default settings. See details below:

class MyClass

def initialize
  config = Settings::Config.create do
    merge_storage( Settings::Yaml.load('path/to/my/yaml/file'),
                   root: 'myclass/default' )
  end

  if config.download?
    @power = config.power
    @value = config.actual.value
  else
    print config['WARNING_MESSAGE']
  end
end

end

This code demonstrates next concepts:

First. You can choose what config part should be loaded. It can be useful for small projects where you do not want to create more than one config file. It means even if whole config placed in one place it is possible to load small data/file part.

Second. You can select an object from where configs can be loaded. By default it can be Settings::Yaml or Settings::ENV provider

Third. Chains are allowed.