Ruby/Reflection/ObjectSpace
Материал из Wiki.crossplatform.ru
ObjectSpace.each_object
ObjectSpace.each_object do |obj| printf "%20s: %s\n", obj.class, obj.inspect end
Print out all exceptions
ObjectSpace.each_object(Class) do |x| puts x if x.ancestors.member? Exception end
Print out only errors
ObjectSpace.each_object(Class) { |x| puts x if x.name =~ /Error$/ }