aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-27 11:07:07 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-27 11:07:07 +0100
commit418e5fc279b19c0d35d3f2b6b5ce216a566c8fc2 (patch)
tree33d51b954b8f6cac5e64e64d2152d6b0ca8cc40c /activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
parent0cb3311d06c02649fb7444c34b6fdf2214ab85f5 (diff)
parenta24a888afe5652e391ce2ea682596686af5ec58b (diff)
downloadrails-418e5fc279b19c0d35d3f2b6b5ce216a566c8fc2.tar.gz
rails-418e5fc279b19c0d35d3f2b6b5ce216a566c8fc2.tar.bz2
rails-418e5fc279b19c0d35d3f2b6b5ce216a566c8fc2.zip
Merge branch 'master' of gitproxy:rails/rails
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.rb14
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