module ObjectSpace
def classes
def classes ObjectSpace.each_object(Module).select do |klass| # Why? Ruby, when you remove a costant dosen't remove it from # rb_tables, this mean that here we can find classes that was # removed. klass.name rescue false end end