Browse files

Add comment for config_accessor method

  • Loading branch information...
1 parent e6f2ef3 commit 30d7a71bf0700c3a53ba59fa23893d0b843954e5 Neeraj Singh committed with fxn Nov 30, 2010
Showing with 13 additions and 1 deletion.
  1. +13 −1 activesupport/lib/active_support/configurable.rb
View
14 activesupport/lib/active_support/configurable.rb
@@ -16,6 +16,18 @@ def configure
yield config
end
+ # Allows you to add shortcut so that you don't have to refer to attribute through config.
+ # Also look at the example for config to contrast.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :allowed_access
+ # end
+ #
+ # user = User.new
+ # user.allowed_access = true
+ # user.allowed_access # => true
+ #
def config_accessor(*names)
names.each do |name|
code, line = <<-RUBY, __LINE__ + 1
@@ -33,4 +45,4 @@ def config
@_config ||= ActiveSupport::InheritableOptions.new(self.class.config)
end
end
-end
+end

0 comments on commit 30d7a71

Please sign in to comment.