From c7adc961868a8a0b83e70fc2be8c60013a20fa1b Mon Sep 17 00:00:00 2001 From: "Josep M. Bach" Date: Sat, 14 Aug 2010 17:01:11 +0200 Subject: [PATCH] Documented active_support/configurable --- .../lib/active_support/configurable.rb | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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/module/delegation' module ActiveSupport + # Configurable provides a config method to store and retrieve + # configuration options as an OrderedHash. module Configurable extend ActiveSupport::Concern @@ -29,8 +31,25 @@ def #{name}=(value); config.#{name} = value; end end end + # Reads and writes attributes from a configuration OrderedHash. + # + # 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 + -- GitLab