this is very useful for meta-programming:

   jib:~/eg/ruby > cat a.rb
   class Object
     def inside_metaclass?
       klass = Class === self ? self : self.class
       obj_meta = class << Object; self; end
       klass.ancestors.include? obj_meta
     end
   end

   p inside_metaclass?

   class << self
     p inside_metaclass?
   end

   class C
     p inside_metaclass?
     class << self
       p inside_metaclass?
       class << self
         p inside_metaclass?
       end
     end
   end


   jib:~/eg/ruby > ruby a.rb
   false
   true
   false
   true
   true


i believe the implementaion is correct iff the following statement is true:

   all meta-classes descend from the meta-class of Object.

-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
===============================================================================