diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb index a0c9c9e33a957..5b85f9394abf8 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 +