Module: Ext::Settings

Extended by:
Equipment
Defined in:
lib/ext/settings.rb

Overview

Settings allow you to have configurable settings in your app. Define your own configuration settings in the app root and then call #load_settings.

NOTE : This Equipment is usable without Camping.

Example

require 'camping'
require 'ext/settings'

Camping.goes :YourApp

module YourApp
  equip Ext::Settings

  setting :database, {:store=>'mysql', :hostname=>'localhost'}

  load_settings('your_config.conf')
end

YourApp.database #=> {:store=>'mysql', :hostname=>'localhost'}

Dependencies

  • Equipment

  • YAML

  • Forwardable

TODO

Implement type-casting ?

Defined Under Namespace

Modules: CClassMethods Classes: Setting, SettingGroup

Constant Summary

Constants included from Equipment

Equipment::DATA_PATH, Equipment::LIB_PATH

Instance Attribute Summary

Attributes included from Equipment

#debug

Class Method Summary collapse

Methods included from Equipment

dependencies, depends_on, equip, equip_all, global_extensions, included

Class Method Details

.equip(app) ⇒ Object

Define C if not defined.



43
44
45
46
# File 'lib/ext/settings.rb', line 43

def self.equip(app)
  app.module_eval "C=self" unless app.const_defined? :C
  super
end