From: Carlos Date: 2005-05-05T08:34:32+09:00 Subject: Re: [RCR] Object#inside_metaclass? [Ara.T.Howard@noaa.gov, 2005-05-05 00.15 CEST] > >def inside? > > self.is_a?(Class) && > > self.name.empty? > > self.ancestors.first != self > >end > > ha! first i noticed you made a typo (the first two lines are a no-op > without > another '&&') - and then i ran it anyhow. funny thing is it seems the last > line is all that's needed (if defined in Class)! Yes, the #name thing was a leftover of some experiments trying to distinguish between singleton classes of classes and the others (unsuccessful). (This version was already in [ruby-talk:140408]...) > not bad! why do you suppose metaclasses don't have themselves as ancestors? > or perhaps put a better way - why DO normal classes? I think Joel VanderWerf's explanation is the most likely.