Class | Settings
In: | lib/facets/more/settings.rb
Parent: | Object

Settings holds configuration information organized by Owners. An owner is a class that represents the system to be configured. An alias for this class is Settings.

You can pass strings, constants or symbols as keys for the classes to be configured. Passing symbols you can configure classes even before they are defined.

### Methods

add_setting load method_missing parse settings setup

### Classes and Modules

Class Settings::Setting
Class Settings::SettingCollection

### External Aliases

add_setting | -> | setting
settings | -> | all
settings | -> | []

### Public Class methods

add_setting(owner, name, options)

Manually add a Settings setting. The class key can be the actual class name constant or a symbol. If the setting is already defined it updates it.

### Examples

Settings.add_setting Compiler, :verification, :value => 12, :doc => ’…’ Settings.setting :IdPart, :verify_registration_email, :value => false s = Settings.Compiler.verification.value

load(filename)

Load and parse an external yaml Settings file.

method_missing(sym)
parse(options)

Parse Settings parameters in yaml format.

settings(owner = nil)

Return the settings for the given owner. The owner is typically the Class that represents the system to be configured. If no class is provided, it returns all the registered settings.

setup(options)

Inject the Settings parameters provided as a hash (dictionary, ordered) to classes to be configured.

### Warning: Pass an ordered hash (dictionary)

[Validate]