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

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

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

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

Returns the hash of default config values for Merb.

Returns

Hash:The defaults for the config.

:api: private

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

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

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

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

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

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

:api: private

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

Returns the configuration as a hash.

Returns

Hash:The config as a hash.

:api: public

Returns the config as YAML.

Returns

String:The config as YAML.

:api: public

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]