Sha256: 087051df59ebcb5d0562efb5026af01381213050eb1c0084be158c8e5b505a82

Contents?: true

Size: 559 Bytes

Versions: 4

Compression:

Stored size: 559 Bytes

Contents

module Tennis
  class Configuration
    DEFAULT = {
      async: true,
      exchange: "tennis",
      workers: 4,
      logger: STDOUT,
      sneakers_options: {},
    }.freeze

    attr_accessor :async, :exchange, :workers, :logger, :sneakers_options

    def initialize(opts = {})
      DEFAULT.merge(opts).each do |name, value|
        __send__("#{name}=", value)
      end
    end

    def finalize!
      Sneakers.configure({
        exchange: exchange,
        workers: workers,
        log: logger,
      }.merge(sneakers_options))
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tennis-jobs-0.3.1 lib/tennis/configuration.rb
tennis-jobs-0.3.0 lib/tennis/configuration.rb
tennis-jobs-0.2.0 lib/tennis/configuration.rb
tennis-jobs-0.1.0 lib/tennis/configuration.rb