As far as i know, ruby use memory location to generate object’s id, normally any dynamic objects(runtime generate objects) will have different object_id, for example “foo”.object_id not equal with “foo”.object_id. But, any object like number, true, false ,nil and symbol all have fixed object_id
As far as i know, ruby use memory location to generate object's id, normally any dynamic objects(runtime generate objects) will have different object_id, for example "foo".object_id not equal with "foo".object_id. But, any object like number, true, false ,nil and symbol all have fixed object_id
Although this is an implementation detail you'd be I'll advised to
rely on - on my rubinius install for example the object id of nil is
26