Revert "Further simplify singleton_class checking in class_attribute"

This reverts commit 520918aad9.

Reason: build failure
This commit is contained in:
Jon Leighton
2011-12-28 18:45:28 +00:00
parent df3701872d
commit bbafe73d8f

View File

@@ -81,13 +81,21 @@ 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} : singleton_class.#{name}
defined?(@#{name}) ? @#{name} : self.class.#{name}
end
def #{name}?
@@ -99,4 +107,9 @@ class Class
attr_writer name if instance_writer
end
end
private
def singleton_class?
!name || '' == name
end
end