diff options
author | Kabari Hendrick <kabari@gmail.com> | 2010-03-14 01:33:45 -0600 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-27 02:07:04 -0700 |
commit | b081948bb3e1a6874f133140bf07e7fb9d3359d9 (patch) | |
tree | ba4ad456cf94d4e563c539f2249f5a4555836fea /activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | |
parent | 334983eca042b5016d3d79d7ed5761b60ba871ed (diff) | |
download | rails-b081948bb3e1a6874f133140bf07e7fb9d3359d9.tar.gz rails-b081948bb3e1a6874f133140bf07e7fb9d3359d9.tar.bz2 rails-b081948bb3e1a6874f133140bf07e7fb9d3359d9.zip |
fixing inconsistency with cattr_reader and matter_reader [#4172 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/attribute_accessors.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors.rb | 14 |
1 files changed, 9 insertions, 5 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 131b512944..c315fd5812 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb @@ -2,7 +2,7 @@ require 'active_support/core_ext/array/extract_options' class Module def mattr_reader(*syms) - syms.extract_options! + options = syms.extract_options! syms.each do |sym| class_eval(<<-EOS, __FILE__, __LINE__ + 1) unless defined? @@#{sym} # unless defined? @@pagination_options @@ -12,11 +12,15 @@ class Module def self.#{sym} # def self.pagination_options @@#{sym} # @@pagination_options end # end - - def #{sym} # def pagination_options - @@#{sym} # @@pagination_options - end # end EOS + + unless options[:instance_reader] == false + class_eval(<<-EOS, __FILE__, __LINE__) + def #{sym} # def hair_colors + @@#{sym} # @@hair_colors + end # end + EOS + end end end |