On Thu, 5 May 2005, Christoph wrote: > Ara.T.Howard / noaa.gov schrieb: > >> >> class Class >> def inside_metaclass? >> inspect =~ %r/^#<Class:/ ? true : false >> end >> end >> >> class Object >> def inside_metaclass? >> self.class.inside_metaclass? >> end >> end > > I see - thats what you call a meta class - actually you > statement seems to be right, just the ancestors implementation > in 1.8 seems to have a bug - try > > > --- > def inside_metaclass? > false > end > > class << Object > private > def inside_metaclass? > true > end > end hmm - seems like something like that could work alright... but this fails: jib:~/eg/ruby > cat a.rb def inside_metaclass? false end class << Object private def inside_metaclass? true end end p inside_metaclass? class << self p inside_metaclass? end class C p inside_metaclass? end jib:~/eg/ruby > ruby a.rb false true true it's not easy... -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | renunciation is not getting rid of the things of this world, but accepting | that they pass away. --aitken roshi ===============================================================================