From: "David A. Black" Date: 2008-03-21T21:34:38+09:00 Subject: Re: get object from its object-specific class? Hi -- On Fri, 21 Mar 2008, Rob Pitt wrote: >> def instance_of_singleton_class_2(sc) > > not only is this method faster but it works in a situation where the > ObjectSpace does not. Consider this rspec test pasted in from a personal > introspection lib. It will work with this method but not with the > ObjectSpace: > > def singleton > class< end > > def singleton_ancestors > result = [] > return result unless pointer = singleton_parent I think you forgot to define singleton_parent. David -- Upcoming Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS, April 14-17 2008, New York City CORE RAILS, June 24-27 2008, London (Skills Matter) See http://www.rubypal.com for details. Berlin dates coming soon!