Module: CLIUtils::Configuration

Defined in:
lib/cliutils/configuration.rb

Overview

Configuration Class

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

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(k)

Methods
====================================================
----------------------------------------------------
included method

Hook called when this module gets mixed in; extends
the includer with the methods defined here.
@param k The includer
@return Void
----------------------------------------------------


22
23
24
# File 'lib/cliutils/configuration.rb', line 22

def self.included(k)
  k.extend(self)
end

Instance Method Details

- (Object) configuration


configuration method

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


33
34
35
# File 'lib/cliutils/configuration.rb', line 33

def configuration
  @configuration ||= Configurator.new('~/.default-cliutils')
end

- (Object) load_configuration(path)


load_configuration method

Initializes a Configurator with the passed filepath.
@param path The path to the config file
@return Void
----------------------------------------------------


44
45
46
# File 'lib/cliutils/configuration.rb', line 44

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