method
__id__
v2_6_3 -
Show latest stable
-
0 notes -
Class: BasicObject
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (-6)
- 2_2_9 (38)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
__id__()
public
Returns an integer identifier for obj.
The same number will be returned on all calls to object_id for a given object, and no two active objects will share an id.
Note: that some objects of builtin classes are reused for optimization. This is the case for immediate values and frozen string literals.
Immediate values are not passed by reference but are passed by value: nil, true, false, Fixnums, Symbols, and some Floats.
Object.new.object_id == Object.new.object_id # => false (21 * 2).object_id == (21 * 2).object_id # => true "hello".object_id == "hello".object_id # => false "hi".freeze.object_id == "hi".freeze.object_id # => true