Sha256: 2920759c21a1ffce9020e39f0248c1c8417ca37368eb67a8a525394d28e9f803

Contents?: true

Size: 520 Bytes

Versions: 1

Compression:

Stored size: 520 Bytes

Contents

require "logger"
require "celluloid"

module Tennis
  class Configuration
    DEFAULT = {
      async: true,
      logger: Logger.new(STDOUT),
    }.freeze

    attr_accessor :async, :logger, :backend

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

    def finalize!
      raise "You must specify a backend during the configuration" unless backend

      # Set the celluloid logger.
      Celluloid.logger = logger
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tennis-jobs-0.4.0 lib/tennis/configuration.rb