Permalink
Browse files

Module#const_defined? checks Object by default in 1.9 [closes #1622]

  • Loading branch information...
1 parent 128670f commit 3c1bb57dad4191d193a161d6240f5090caedfd27 @fxn fxn committed Mar 19, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 kernel/common/module19.rb
@@ -47,10 +47,14 @@ def const_defined?(name, search_parents=true)
if search_parents
current = self.direct_superclass
- while current and current != Object
+ while current
return true if current.constant_table.has_key? name
current = current.direct_superclass
end
+
+ if instance_of?(Module)
+ return true if Object.constant_table.has_key? name
+ end
end
return false

0 comments on commit 3c1bb57

Please sign in to comment.