Module: Runscope::Configuration

Included in:
Runscope
Defined in:
lib/runscope-rb/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
  :bucket,
  :domains,
  :enabled
]
DEFAULT_ENABLED =

By default, use Runscope

true
DEFAULT_DOMAINS =

By default, send no traffic to Runscope

[]
DEFAULT_BUCKET =

By default, don’t set a bucket

nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

When this module is extended, set all configuration options to their default values



21
22
23
# File 'lib/runscope-rb/configuration.rb', line 21

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Convenience method to allow configuration options to be set in a block

Yields:

  • (_self)

Yield Parameters:



26
27
28
# File 'lib/runscope-rb/configuration.rb', line 26

def configure
  yield self
end

#optionsObject

Create a hash of options and their values



31
32
33
# File 'lib/runscope-rb/configuration.rb', line 31

def options
  Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]
end

#resetObject



35
36
37
38
39
# File 'lib/runscope-rb/configuration.rb', line 35

def reset
  self.bucket   = DEFAULT_BUCKET
  self.domains  = DEFAULT_DOMAINS
  self.enabled  = DEFAULT_ENABLED
end