From: Eric Mahurin Date: 2005-10-31T00:57:53+09:00 Subject: Re: determining whether an object is an immediate? It is slow, but this is probably one of the better definitions of what an immediate is - whether it exists in ObjectSpace or not. Here's another solution: class Object; def immediate?;false;end;end class Fixnum; def immediate?;true; end;end class Symbol; def immediate?;true; end;end class NilClass; def immediate?;true; end;end class FalseClass;def immediate?;true; end;end class TrueClass; def immediate?;true; end;end --- Gene Tani wrote: > you think #clone is slow, try (you could test for adding > singleton > methods, that would be even slower!): > > + x.report("objSpace ") do > + ITERATIONS.times do > + OBJECTS.each do |obj| > + begin > + if ObjectSpace.include?(obj) > + # nothin > + end > + rescue TypeError > + # noting > + end > + end > + end > + end > > Timothy Hunter wrote: > > Eric Mahurin wrote: > > > This is be best I could come up with for determining > whether an > > > object is an immediate (Fixnum, Symbol, false, true, nil, > > > others?): > > > > > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com