From cdf7a6013dcea316d8a4c3336afe7037cc1a813e Mon Sep 17 00:00:00 2001 From: James Miller Date: Wed, 28 Dec 2011 09:19:46 -0800 Subject: Further simplify singleton_class checking in class_attribute --- .../lib/active_support/core_ext/class/attribute.rb | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'activesupport/lib/active_support/core_ext') diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index 45bec264ff..a04445d34d 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -81,21 +81,13 @@ class Class define_method(:#{name}) { val } end - if singleton_class? - class_eval do - remove_possible_method(:#{name}) - def #{name} - defined?(@#{name}) ? @#{name} : singleton_class.#{name} - end - end - end val end if instance_reader remove_possible_method :#{name} def #{name} - defined?(@#{name}) ? @#{name} : self.class.#{name} + defined?(@#{name}) ? @#{name} : singleton_class.#{name} end def #{name}? @@ -107,9 +99,4 @@ class Class attr_writer name if instance_writer end end - - private - def singleton_class? - !name || '' == name - end end -- cgit v1.2.3