Sha256: cb94e4ee4d9c1b76d537decdda9403ede485589f214d9c8d6b8089eed41cf354

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Kthxbye
  # This module handles the setting and retrival of configuration options for
  # Kthxbye.
  module Config

    # Default options for Kthxbye 
    #
    # * redis_server = "127.0.0.1" - the ip to connect to by defaut
    # * redis_port = 9876 - default redis port
    # * attempts = 1 -default number of attempts on a failing job before a Failure
    # is generated 
    # * vervose = false - more output in the worker log
    DEFAULT = {:redis_server => '127.0.0.1',
      :redis_port => 9876,
      :attempts => 1,
      :verbose => false}.freeze
    
    # This method takes override args input by the user. 
    # Can pull from a config/kthxbye.yaml file as well. 
    # 
    # NEEDS TO BE REWORKED FOR RAILS APPS
    def self.setup( args=nil )
      @options = DEFAULT.dup
      @options.merge!( YAML.load('./config/kthxbye.yaml') ) if File.exist?( './config/kthxbye.yaml' )
      @options.merge!( args ) if args
    end

    # Quick access to the options hash. Works for setting individual options 
    # during runtime.
    def self.options
      return @options if @options
      Config.setup
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kthxbye-1.1.1 lib/kthxbye/config.rb
kthxbye-1.1.0 lib/kthxbye/config.rb
kthxbye-1.0.5 lib/kthxbye/config.rb
kthxbye-1.0.4 lib/kthxbye/config.rb
kthxbye-1.0.2 lib/kthxbye/config.rb