diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-06-14 14:56:58 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-06-14 14:56:58 +0530 |
commit | bf526c2dbeb73bf11553004e43889a804b72866d (patch) | |
tree | 1edf41ca8aa19548b86f161cb1c81ce728ed347d /activesupport/lib | |
parent | 954359b9c260f0e1265237c20bb3e4834a11fb9a (diff) | |
download | rails-bf526c2dbeb73bf11553004e43889a804b72866d.tar.gz rails-bf526c2dbeb73bf11553004e43889a804b72866d.tar.bz2 rails-bf526c2dbeb73bf11553004e43889a804b72866d.zip |
Added instance_accessor: false to Module#mattr_accessor
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb index 871f5cef3b..be94ae1565 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -12,7 +12,7 @@ class Module end EOS - unless options[:instance_reader] == false + unless options[:instance_reader] == false || options[:instance_accessor] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym} @@#{sym} @@ -31,7 +31,7 @@ class Module end EOS - unless options[:instance_writer] == false + unless options[:instance_writer] == false || options[:instance_accessor] == false class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym}=(obj) @@#{sym} = obj @@ -53,6 +53,10 @@ class Module # end # # AppConfiguration.google_api_key = "overriding the api key!" + # + # To opt out of the instance writer method, pass :instance_writer => false. + # To opt out of the instance reader method, pass :instance_reader => false. + # To opt out of both instance methods, pass :instance_accessor => false. def mattr_accessor(*syms) mattr_reader(*syms) mattr_writer(*syms) |