From cdc4274931c2d6bafdf2b97f7e4ecedf89a8202e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 23 Jul 2011 20:02:03 -0700 Subject: simplify singleton_class? method --- activesupport/lib/active_support/core_ext/class/attribute.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb index ca9b2c1b60..45bec264ff 100644 --- a/activesupport/lib/active_support/core_ext/class/attribute.rb +++ b/activesupport/lib/active_support/core_ext/class/attribute.rb @@ -110,12 +110,6 @@ class Class private def singleton_class? - # in case somebody is crazy enough to overwrite allocate - allocate = Class.instance_method(:allocate) - # object.class always points to a real (non-singleton) class - allocate.bind(self).call.class != self - rescue TypeError - # MRI/YARV/JRuby all disallow creating new instances of a singleton class - true + !name || '' == name end end -- cgit v1.2.3