Class | Merb::Config
In: | lib/merb-core/dispatch/session.rb lib/merb-core/config.rb
Parent: | Object

### Methods

[] []= configure defaults delete fetch key? method_missing parse_args session_stores setup to_hash to_yaml use

### Classes and Modules

Class Merb::Config::ConfigBlock

### Attributes

configuration | [RW] | :api: private

### Public Class methods

[](key)

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

[]=(key, val)

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

configure(&block)

Set configuration parameters from a code block, where each method evaluates to a config parameter.

#### Parameters

&block: | Configuration parameter block.

#### Examples

      # Set environment and log level.
      Merb::Config.configure do
        environment "development"
        log_level   "debug"
        log_file    Merb.root / "log" / "special.log"
      end

#### Returns

nil

:api: public

defaults()

Returns the hash of default config values for Merb.

#### Returns

Hash: | The defaults for the config.

:api: private

delete(key)

Remove the value of a config entry.

#### Parameters

key<Object>: | The key of the parameter to delete.

#### Returns

Object: | The value of the removed entry.

:api: public

fetch(key, default)

Retrieve the value of a config entry, returning the provided default if the key is not present

#### Parameters

key<Object>: | The key to retrieve the parameter for.
default<Object>: | The default value to return if the parameter is not set.

#### Returns

Object: | The value of the configuration parameter or the default.

:api: public

key?(key)

Detects whether the provided key is in the config.

#### Parameters

key<Object>: | The key to check.

#### Returns

Boolean: | True if the key exists in the config.

:api: public

method_missing(method, *args)

Allows retrieval of single key config values via Merb.config.<key> Allows single key assignment via Merb.config.<key> = …

#### Parameters

method<~to_s>: | Method name as hash key value.
*args: | Value to set the configuration parameter to.

#### Returns

The value of the entry fetched or assigned to.

:api: public

parse_args(argv = ARGV)

Parses the command line arguments and stores them in the config.

#### Parameters

argv<String>: | The command line arguments. Defaults to `ARGV`.

#### Returns

The configuration as a hash.

:api: private

session_stores()

Returns stores list constructed from configured session stores (:session_stores config option) or default one (:session_store config option).

:api: private

setup(settings = {})

Sets up the configuration by storing the given settings.

#### Parameters

settings<Hash>: | Configuration settings to use. These are merged with the defaults.

#### Returns

The configuration as a hash.

:api: private

to_hash()

Returns the configuration as a hash.

#### Returns

Hash: | The config as a hash.

:api: public

to_yaml()

Returns the config as YAML.

#### Returns

String: | The config as YAML.

:api: public

use() {|@configuration| ...}

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: public

[Validate]