Class: Mordor::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/mordor/config.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

Retrieve the value of a config entry.

Parameters

key<Object>

The key to retrieve the parameter for.

Returns

Object

The value of the configuration parameter.

:api: public



41
42
43
# File 'lib/mordor/config.rb', line 41

def [](key)
  (@configuration ||= setup)[key]
end

.[]=(key, val) ⇒ Object

Set the value of a config entry.

Parameters

key<Object>

The key to set the parameter for.

val<Object>

The value of the parameter.

:api: public



52
53
54
# File 'lib/mordor/config.rb', line 52

def []=(key, val)
  (@configuration ||= setup)[key] = val
end

.resetObject

Resets the configuration to its default state



28
29
30
# File 'lib/mordor/config.rb', line 28

def reset
  setup
end

.use {|@configuration| ... } ⇒ Object

Yields the configuration.

Block parameters

c<Hash>

The configuration parameters.

Examples

Merb::Config.use do |config|
  config[:exception_details] = false
  config[:log_stream]        = STDOUT
end

Returns

nil

:api: publicdef use

Yields:

  • (@configuration)


20
21
22
23
24
# File 'lib/mordor/config.rb', line 20

def use
  @configuration ||= defaults
  yield @configuration
  nil
end