Class: Mordor::Config
- Inherits:
-
Object
- Object
- Mordor::Config
- Defined in:
- lib/mordor/config.rb
Class Method Summary collapse
-
.[](key) ⇒ Object
Retrieve the value of a config entry.
-
.[]=(key, val) ⇒ Object
Set the value of a config entry.
-
.reset ⇒ Object
Resets the configuration to its default state.
-
.use {|@configuration| ... } ⇒ Object
Yields the configuration.
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 |
.reset ⇒ Object
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
20 21 22 23 24 |
# File 'lib/mordor/config.rb', line 20 def use @configuration ||= defaults yield @configuration nil end |