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

Methods

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

Public Class methods

Parameters

key<Object>:The key to retrieve the parameter for.

Returns

Object:The value of the configuration parameter.

Parameters

key<Object>:The key to set the parameter for.
val<Object>:The value of the parameter.

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"
  end

Returns

Hash:The defaults for the config.

Parameters

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

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.

Parameters

key<Object>:The key to check.

Returns

Boolean:True if the key exists in the config.

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

Parameters

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

Sets up the configuration by storing the given settings.

Parameters

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

Returns

Hash:The config as a hash.

Returns

String:The config as YAML.

Yields the configuration.

Block parameters

c<Hash>:The configuration parameters.

Examples

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

[Validate]