(2011/09/30 5:37), hemant wrote:
> I think reference_from is a bit ambiguous as it stands. How about "contains" ?

ObjectSpace.contains(obj)  ?

> I am not sure, what values are in the output though. Are they Type or
> output of inspect?


As I wrote in first post:

> h = {'a' => [1, 2, 3], 'b' => Object.new}
> p ObjectSpace.reference_from(h)
> #=>
> {76577650=>Hash, 76559320=>"a", 76559360=>[1, 2, 3], 76559310=>"b",
> 76559340=>#<Object:0x92067d8>}
> 
> Hash keys are object id and values are objects themselves.

Output is inspected string by "p".

-- 
// SASADA Koichi at atdot dot net