Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1709 from troessner/master

BasicObject includes itself in its list of constants.
  • Loading branch information...
commit 9153ef626e0ec1608c8f72de6e63d3acfa6de249 2 parents d88af5b + 1435289
@jc00ke jc00ke authored
4 kernel/common/module19.rb
@@ -114,6 +114,10 @@ def autoload(name, path)
def constants(all=undefined)
tbl =
+ # When calling `constants` on "normal" classes the result does not include
+ # their own class name. BasicObject is a special case in this regard.
+ tbl[:BasicObject] = true if self == BasicObject
@constant_table.each do |name, val|
tbl[name] = true
1  spec/tags/19/ruby/core/basicobject/basicobject_tags.txt
@@ -1,3 +1,2 @@
fails:BasicObject raises NameError when referencing built-in constants
fails:BasicObject does not define built-in constants (according to defined?)
-fails:BasicObject includes itself in its list of constants
Please sign in to comment.
Something went wrong with that request. Please try again.