From: botp Date: 2008-03-24T01:10:16+09:00 Subject: Re: Sytem hook for instance names? On Sun, Mar 23, 2008 at 11:15 PM, Jeff Patterson wrote: > Is there a system hook that allows a method to get an instance's symbol from its' object id? i do not understand what you mean by instance symbol but you can refer fr an id back to the actual object if you want to. so but how about, irb(main):021:0> a="testing" => "testing" irb(main):022:0> x=a.object_id => -606066648 irb(main):023:0> ObjectSpace._id2ref(x) => "testing" irb(main):024:0> ObjectSpace._id2ref(x).upcase! => "TESTING" irb(main):025:0> a => "TESTING" irb(main):026:0> b=Class.new => # irb(main):027:0> y=b.object_id => -606090998 irb(main):028:0> ObjectSpace._id2ref(y) => # irb(main):029:0> ObjectSpace._id2ref(y).class_eval "def hello; 'hello'; end" => nil irb(main):031:0> b.new.hello => "hello" hth. kind regards -botp