aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/configurable.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-12-05 10:33:50 +0100
committerXavier Noria <fxn@hashref.com>2010-12-05 10:33:50 +0100
commit48386d245bc169d3a36e5f305927bd968b108fea (patch)
tree9156d3535c42e7f56af6e69fbbd5164ccb4fcc95 /activesupport/lib/active_support/configurable.rb
parentb696dd70db651c6cb4a096dd0d5762416acd9917 (diff)
parente1d0d5ae81d2b02eebb1afbfb79edf0a2da2d48e (diff)
downloadrails-48386d245bc169d3a36e5f305927bd968b108fea.tar.gz
rails-48386d245bc169d3a36e5f305927bd968b108fea.tar.bz2
rails-48386d245bc169d3a36e5f305927bd968b108fea.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activesupport/lib/active_support/configurable.rb')
-rw-r--r--activesupport/lib/active_support/configurable.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb
index 58ed37b018..644db0b205 100644
--- a/activesupport/lib/active_support/configurable.rb
+++ b/activesupport/lib/active_support/configurable.rb
@@ -38,6 +38,18 @@ module ActiveSupport
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