Skip to content
This repository
Browse code

simplify singleton_class? method

  • Loading branch information...
commit cdc4274931c2d6bafdf2b97f7e4ecedf89a8202e 1 parent 06c52d6
Aaron Patterson authored July 23, 2011
8  activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -110,12 +110,6 @@ def #{name}?
110 110
 
111 111
   private
112 112
   def singleton_class?
113  
-    # in case somebody is crazy enough to overwrite allocate
114  
-    allocate = Class.instance_method(:allocate)
115  
-    # object.class always points to a real (non-singleton) class
116  
-    allocate.bind(self).call.class != self
117  
-  rescue TypeError
118  
-    # MRI/YARV/JRuby all disallow creating new instances of a singleton class
119  
-    true
  113
+    !name || '' == name
120 114
   end
121 115
 end

0 notes on commit cdc4274

Please sign in to comment.
Something went wrong with that request. Please try again.