From: Rajinder Yadav Date: 2009-12-23T00:52:16+09:00 Subject: Re: integers and floats Robert Klemme wrote: > 2009/12/22 Florian Gilcher : >> On Dec 22, 2009, at 11:03 AM, Paul Smith wrote: >> >>> On Tue, Dec 22, 2009 at 2:16 PM, Rajinder Yadav wrote: >>> I have no idea what, if anything, has the object_ids 0, and 2. >> Pretty easy: false and true. >> >> irb(main):001:0> true.object_id >> => 2 >> irb(main):002:0> false.object_id >> => 0 > > You need to know but there is a way that works without oracle turing machine: > > irb(main):005:0> 10.times {|i| printf "%4d %p\n", i, > ObjectSpace._id2ref(i) rescue nil} > 0 false > 1 0 > 2 true > 3 1 > 4 nil > 5 2 > 7 3 > 9 4 > => 10 > > :-) > > Kind regards > > robert Robert thanks for the code snippet, that is so cool =) ... more stuff to add to my notes! -- Kind Regards, Rajinder Yadav http://DevMentor.org Do Good! - Share Freely