Identidad de un Objeto

Every object has an object identifier, a Fixnum, that you can obtain with the object_id method. The value returned by this method is constant and unique for the lifetime of the object. While the object is accessible, it will always have the same ID, and no other object will share that ID.

ruby-1.9.2-p290 :003 > a = 4
 => 4 
ruby-1.9.2-p290 :004 > a.__id__
 => 9 
ruby-1.9.2-p290 :005 > a.object_id
 => 9 
ruby-1.9.2-p290 :006 > x = "hello"
 => "hello" 
ruby-1.9.2-p290 :007 > x.__id__
 => 70103467703860 
ruby-1.9.2-p290 :008 > x.object_id
 => 70103467703860

Es único durante la vida del objeto.

Casiano Rodriguez León 2015-01-07