Sha256: 58307adcdf64b2438ccfb0cfe3d50653cfc6dc0973a7702434f7602dc5b78da0

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

require 'yaml'

module CLIUtils
  # Configuration Module
  # Manages any configuration values and the flat YAML file
  # into which they get stored.
  module Configuration
    # 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
      @@configuration ||= Configurator.new('~/.default-cliutils')
    end

    # Singleton method to return (or initialize, if needed)
    # a Configurator.
    # @param [String] path The filepath to use
    # @return [void]
    def load_configuration(path)
      @@configuration = Configurator.new(path)
    end
    alias configuration= load_configuration
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cliutils-1.0.5 lib/cliutils/configuration.rb