Skip to content

Commit

Permalink
Revert "Merge pull request #4220 from bensie/singleton-class-master"
Browse files Browse the repository at this point in the history
This reverts commit 90df0d4, reversing
changes made to 5e6fc81.

Reason: build breakage
  • Loading branch information
jonleighton committed Dec 28, 2011
1 parent 6e5b98e commit 9bae926
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion activesupport/lib/active_support/core_ext/class/attribute.rb
Expand Up @@ -81,13 +81,21 @@ def self.#{name}=(val)
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}?
Expand All @@ -99,4 +107,9 @@ def #{name}?
attr_writer name if instance_writer
end
end

private
def singleton_class?
!name || '' == name
end
end

0 comments on commit 9bae926

Please sign in to comment.