On Mon, Jan 29, 2007 at 02:15:11AM +0900, Thomas Hafner wrote:
> Hello,
> 
> how can I write a method f which fullfills the following
> specification?
> 
> The function f has one Fixnum argument oi.
> f(oi) == [true, obj], if there's an object obj with obj.object_id == oi;
> f(oi) == [false, nil], otherwise.

def f(oi)
  g = [false, nil]
  ObjectSpace.each_object { |a|
    g = [true, a] if a.object_id == oi
  }
  g
end

-- 
Aaron Patterson
http://tenderlovemaking.com/