aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/configurable.rb
diff options
context:
space:
mode:
authorJosep M. Bach <josep.m.bach@gmail.com>2010-08-14 17:01:11 +0200
committerXavier Noria <fxn@hashref.com>2010-08-15 02:22:37 +0200
commitc7adc961868a8a0b83e70fc2be8c60013a20fa1b (patch)
treed2364e1425bc2b3afb42737d3abad361b928aa06 /activesupport/lib/active_support/configurable.rb
parentca87d0a395c43eb95f0f744dd71b85cfb76e9545 (diff)
downloadrails-c7adc961868a8a0b83e70fc2be8c60013a20fa1b.tar.gz
rails-c7adc961868a8a0b83e70fc2be8c60013a20fa1b.tar.bz2
rails-c7adc961868a8a0b83e70fc2be8c60013a20fa1b.zip
Documented active_support/configurable
Diffstat (limited to 'activesupport/lib/active_support/configurable.rb')
-rw-r--r--activesupport/lib/active_support/configurable.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb
index a0c9c9e33a..5b85f9394a 100644
--- a/activesupport/lib/active_support/configurable.rb
+++ b/activesupport/lib/active_support/configurable.rb
@@ -4,6 +4,8 @@ require 'active_support/core_ext/kernel/singleton_class'
require 'active_support/core_ext/module/delegation'
module ActiveSupport
+ # Configurable provides a <tt>config</tt> method to store and retrieve
+ # configuration options as an <tt>OrderedHash</tt>.
module Configurable
extend ActiveSupport::Concern
@@ -29,8 +31,25 @@ module ActiveSupport
end
end
+ # Reads and writes attributes from a configuration <tt>OrderedHash</tt>.
+ #
+ # require 'active_support/configurable'
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # end
+ #
+ # user = User.new
+ #
+ # user.config.allowed_access = true
+ # user.config.level = 1
+ #
+ # user.config.allowed_access # => true
+ # user.config.level # => 1
+ #
def config
@_config ||= ActiveSupport::InheritableOptions.new(self.class.config)
end
end
-end \ No newline at end of file
+end
+