Sha256: f8f3797b3a975d8379deb3c9185e5eca7b3e9c3a3e69d93d455320ff4aff5e04

Contents?: true

Size: 783 Bytes

Versions: 28

Compression:

Stored size: 783 Bytes

Contents

require 'singleton'

require 'awspec/error'

module Awspec
  class Config
    include Singleton

    def initialize
      @config = {
        client_backoff: 0.0,
        client_backoff_limit: 30.0,
        client_iteration: 1
      }
    end

    def client_backoff(backoff)
      @config[:client_backoff] = backoff
    end

    def client_backoff_limit(backoff_limit)
      @config[:client_backoff_limit] = backoff_limit
    end

    def client_iteration(iteration)
      @config[:client_iteration] = iteration
    end

    def [](key)
      @config.fetch(key)
    end

    def method_missing(method_name, *_args)
      raise UnknownConfiguration, "'#{method_name}' is not a valid configuration for Awspec."
    end
  end

  def self.configure
    yield(Config.instance)
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
cthiesfork-awspec-1.2.2 lib/awspec/config.rb
cthiesfork-awspec-1.2.1 lib/awspec/config.rb
awspec-1.18.5 lib/awspec/config.rb
cthiesfork-awspec-1.2.0 lib/awspec/config.rb
cthiesfork-awspec-1.1.0 lib/awspec/config.rb
cthiesfork-awspec-1.0.0 lib/awspec/config.rb
awspec-1.18.4 lib/awspec/config.rb
awspec-1.18.3 lib/awspec/config.rb