Class: Upcheck::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/upcheck/configuration.rb

Constant Summary collapse

DEFAULT_HTTP_TIMEOUT =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
13
14
# File 'lib/upcheck/configuration.rb', line 10

def initialize
  @http_timeout = DEFAULT_HTTP_TIMEOUT
  @providers = {}
  Registry.register_defaults(self)
end

Instance Attribute Details

#http_timeoutObject

Returns the value of attribute http_timeout.



7
8
9
# File 'lib/upcheck/configuration.rb', line 7

def http_timeout
  @http_timeout
end

#providersObject (readonly)

Returns the value of attribute providers.



8
9
10
# File 'lib/upcheck/configuration.rb', line 8

def providers
  @providers
end

Instance Method Details

#register_provider(name, &block) ⇒ Object

Raises:

  • (ArgumentError)


16
17
18
19
20
# File 'lib/upcheck/configuration.rb', line 16

def register_provider(name, &block)
  raise ArgumentError, "register_provider requires a block returning an adapter" unless block

  @providers[name.to_sym] = block
end