lib/cliutils/configuration.rb in cliutils-2.2.0 vs lib/cliutils/configuration.rb in cliutils-2.2.1
- old
+ new
@@ -3,10 +3,12 @@
module CLIUtils
# Configuration Module
# Manages any configuration values and the flat YAML file
# into which they get stored.
module Configuration
+ extend self
+
# Allows easy access to Logger levels.
LOG_LEVELS = {
'DEBUG' => Logger::DEBUG,
'INFO' => Logger::INFO,
'WARN' => Logger::WARN,
@@ -14,17 +16,10 @@
'FATAL' => Logger::FATAL
}
@@configuration = nil
- # Hook that triggers when this module is included.
- # @param [Object] k The includer object
- # @return [void]
- def self.included(k)
- k.extend(self)
- end
-
# Singleton method to return (or initialize, if needed)
# a Configurator.
# @return [Configurator]
def configuration
if @@configuration
@@ -40,7 +35,8 @@
# @param [String] path The filepath to use
# @return [void]
def load_configuration(path)
@@configuration = Configurator.new(path)
end
+ alias_method :filepath=, :load_configuration
end
end