Module: CLIUtils::Configuration

Extended by:
Configuration
Included in:
Configuration
Defined in:
lib/cliutils/configuration.rb

Overview

Configuration Module Manages any configuration values and the flat YAML file into which they get stored.

Constant Summary collapse

LOG_LEVELS =

Allows easy access to Logger levels.

{
  'DEBUG' => Logger::DEBUG,
  'INFO'  => Logger::INFO,
  'WARN'  => Logger::WARN,
  'ERROR' => Logger::ERROR,
  'FATAL' => Logger::FATAL
}
@@configuration =
nil

Instance Method Summary collapse

Instance Method Details

#configurationConfigurator

Singleton method to return (or initialize, if needed) a Configurator.

Returns:



24
25
26
27
28
29
30
31
# File 'lib/cliutils/configuration.rb', line 24

def configuration
  if @@configuration
    @@configuration
  else
    fail 'Attempted to access `configuration` before ' \
    'executing `load_configuration`'
  end
end

#load_configuration(path) ⇒ void Also known as: filepath=

This method returns an undefined value.

Singleton method to return (or initialize, if needed) a Configurator.

Parameters:

  • path (String)

    The filepath to use



37
38
39
# File 'lib/cliutils/configuration.rb', line 37

def load_configuration(path)
  @@configuration = Configurator.new(path)
end