Method: ActiveSettings::Config.namespace

Defined in:
lib/active_settings/config.rb

.namespace(prefix, options = {}, &block) ⇒ Object

A convenient drying method for specifying a prefix and options common to several settings.

ActiveSettings.detail.configure do |config|
  config.namespace('secret', :allow_display => false) do |secret|
    secret.define('identity', :default => 'batman')      # defines 'secret.identity'
    secret.define('lair', :default => 'batcave')         # defines 'secret.lair'
    secret.define('longing', :default => 'vindication')  # defines 'secret.longing'
  end
end


122
123
124
125
# File 'lib/active_settings/config.rb', line 122

def namespace(prefix, options = {}, &block)
  prefix = [options[:prefix], prefix].join('.') if options[:prefix]
  with_options(options.merge(:prefix => prefix), &block)
end