From: Lars Westergren Date: 2007-07-25T20:47:52+09:00 Subject: Re: Detecting singletons Robert Dober skrev: > On 7/25/07, Robert Dober wrote: > Did I do something stupid? Oh, good, so it wasn't just me then. :) It doesn't seem to work for me either. I get false, and then the exception anyway. I think that test only works if the class in question used the Singleton module mixin, I believe the problematic class probably uses some form of sing = class << self; self end magic. I tried looking at the code for marshalling, but alas, it was C, and therefore not much help to me... if (FL_TEST(klass, FL_SINGLETON)) { if (check && RCLASS(klass)->m_tbl->num_entries || (RCLASS(klass)->iv_tbl && RCLASS(klass)->iv_tbl->num_entries > 1)) { rb_raise(rb_eTypeError, "singleton can't be dumped"); } Thanks, Lars