object_id
of a Fixnum
is an odd number:
i=0; i += 1 while i.object_id.odd?
# ^CIRB::Abort: abort then interrupt!
i # => 495394962
while it seems that the object_id
of any other object is an even number (Bignum
included):
{}.object_id # => 70230978908220
true.object_id # => 20
false.object_id # => 0
nil.object_id # => 8
/regexp/.object_id # => 70230978711620
:symbol.object_id # => 391528
{/regexp/mou => Struct.new(:hello)}.object_id # => 70230987100840
Does this have something to do with some obscure optimization within the Ruby interpreter?