This project is archived and is in readonly mode.

#6432 open

"".constantize returns Object

Reported by alindeman | February 14th, 2011 @ 10:06 PM

Not 100% sure if this should be considered a bug, but I found it a bit unexpected and it masked a bug in a project I was working:

ruby-1.9.2-p136 :001 > "".constantize
 => Object 
ruby-1.9.2-p136 :003 > "".constantize == ::Object
 => true

I expected an error, as if I had done:

ruby-1.9.2-p136 :008 > Object.const_get("")
NameError: wrong constant name

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>