From: "Florian Groß" Date: 2005-04-29T21:30:40+09:00 Subject: Re: determining when inside 'class << self' Mark Hubbart wrote: > To expand on that... metaclasses have a peculiar inspect value. This > code is breakable, but probably only if you try to: > > [...] > > There's probably a safer way to do this using ruby/dl, or evil.rb. I > don't know, though. I'm not sure if you consider this safer, but while you can subclass anonymous and normal classes you can not do so for idioclasses so this ought to work: class Class def idioclass?() Class.new(self) return true rescue TypeError return false end end Of course somebody /could/ raise a TypeError in the inherited hook, but that is quite unlikely to happen. evil-ruby can of course check the actual RTYPE of the class which is unbreakable, but that is a dependency you might not want to have.