aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJosep M. Bach <josep.m.bach@gmail.com>2010-08-14 17:01:11 +0200
committerJosep M. Bach <josep.m.bach@gmail.com>2010-08-14 17:02:39 +0200
commit25145d6f5f173dbba2945ab2b4fffa5a67785bb5 (patch)
treec66095f52802cd30bf8ead694b8954448cff5c7c /activesupport
parentb5175566af8d77ee990fa70e262c8b05119add49 (diff)
downloadrails-25145d6f5f173dbba2945ab2b4fffa5a67785bb5.tar.gz
rails-25145d6f5f173dbba2945ab2b4fffa5a67785bb5.tar.bz2
rails-25145d6f5f173dbba2945ab2b4fffa5a67785bb5.zip
Documented active_support/configurable
Diffstat (limited to 'activesupport')
-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
+