R
Rick DeNatale
The following is the culmination of a discussion on ruby-talk from a
few days ago.
Someone asked if there was a way to find the instance of a singleton
class if you only had the class. After positing a solution using
ObjectSpace.each_object, I then wrote a small extension to get it via
the hidden __attached__ instance variable.
I was then asked to submit it to ruby-core, although I'm not sure
whether it's a problem which needs to be addressed in the core.
But just in case here's the discussion. If there's interest, I could
come up with a patch for 1.8.5, 1.8.6, and maybe 1.9.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/
Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/
few days ago.
Someone asked if there was a way to find the instance of a singleton
class if you only had the class. After positing a solution using
ObjectSpace.each_object, I then wrote a small extension to get it via
the hidden __attached__ instance variable.
I was then asked to submit it to ruby-core, although I'm not sure
whether it's a problem which needs to be addressed in the core.
But just in case here's the discussion. If there's interest, I could
come up with a patch for 1.8.5, 1.8.6, and maybe 1.9.
Actually, you mean Pit. He did the benchmarks. This is definitely the
way to do it right though. I would submit this to ruby-core mailing
list and see how it takes over there.
T.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/
Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/