23 Ağustos 2007 Perşembe

Print Exception Class Hieararchy

Author: dr_bob

require 'pp'
tree = (cr = lambda {h,k h[k] = Hash.new &cr})[{},nil]
ObjectSpace.each_object(Class) {cl if cl.ancestors.include? Exception
then cl.ancestors.reverse.inject(tree){tr,cl tr[cl]} end}
pp tree


0 Comments: