Sha256: ef663f04b83a2eed4b2647c0124c5a18a0c43317b3589139f3f78c551d598647

Contents?: true

Size: 841 Bytes

Versions: 2

Compression:

Stored size: 841 Bytes

Contents

module Kthxbye
  module Config

    # default options for Kthxbye
    #
    # redis_server = the ip to connect to by defaut
    # 
    # redis_port = default redis port
    # 
    # attempts = default number of attempts on a failing job
    # before moving to the failed job store
    #
    # vervose = more output 
    #
    DEFAULT = {:redis_server => '127.0.0.1',
      :redis_port => 9876,
      :attempts => 1,
      :verbose => false}.freeze
    
    # configures any other args input by the user. 
    # can pull from a config.yaml file as well.
    #
    def self.setup( args=nil )
      @options = DEFAULT.dup
      @options.merge!( YAML.load('config.yaml') ) if File.exist?( 'config.yaml' )
      @options.merge!( args ) if args
    end

    def self.options
      return @options if @options
      Config.setup
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kthxbye-1.0.1 lib/kthxbye/config.rb
kthxbye-1.0.0 lib/kthxbye/config.rb