Sha256: 6d10898591babcf915455847c638f38c9d21f766e41411a4de47485bbdfa73f2

Contents?: true

Size: 814 Bytes

Versions: 12

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

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

12 entries across 12 versions & 1 rubygems

Version Path
awspec-1.30.0 lib/awspec/config.rb
awspec-1.29.3 lib/awspec/config.rb
awspec-1.29.2 lib/awspec/config.rb
awspec-1.29.1 lib/awspec/config.rb
awspec-1.29.0 lib/awspec/config.rb
awspec-1.28.2 lib/awspec/config.rb
awspec-1.28.1 lib/awspec/config.rb
awspec-1.28.0 lib/awspec/config.rb
awspec-1.27.1 lib/awspec/config.rb
awspec-1.27.0 lib/awspec/config.rb
awspec-1.26.0 lib/awspec/config.rb
awspec-1.25.2 lib/awspec/config.rb