Robert Klemme
4/6/2007 9:53:00 AM
On 06.04.2007 02:54, Trans wrote:
>
> On Apr 5, 5:34 pm, "Ara.T.Howard" <ara.t.how...@noaa.gov> wrote:
>> harp:~ > cat errno
>> #! /usr/bin/env ruby
>> 256.times do |errno|
>> puts "#{ errno } => #{ SystemCallError.new(errno).inspect }"
>> end
>
> Nice.
>
> Hmm... How about an inheritance tree too?
robert@fussel /cygdrive/c/Temp
$ ruby tr.rb > tree.txt
robert@fussel /cygdrive/c/Temp
$ wc -l tree.txt
897 tree.txt
robert@fussel /cygdrive/c/Temp
$ cat tr.rb
require 'pp'
ins = lambda {|h,k| h[k] = Hash.new(&ins)}
tree = Hash.new(&ins)
ObjectSpace.each_object(Class) {|cl| tree[cl.superclass][cl] = tree[cl]}
pp tree
robert@fussel /cygdrive/c/Temp
$ head -20 tree.txt
{Errno::ESPIPE=>{},
Errno::ENOLINK=>{},
Errno::EISCONN=>{},
ThreadError=>{},
Errno::ENOEXEC=>{},
Errno::EL3HLT=>{},
MatchData=>{},
Errno::ELIBEXEC=>{},
Errno::EMFILE=>{},
Errno::ENETUNREACH=>{},
StandardError=>
{RangeError=>{FloatDomainError=>{}},
ThreadError=>{},
RegexpError=>{},
NameError=>{NoMethodError=>{}},
IOError=>{EOFError=>{}},
RuntimeError=>{},
SystemStackError=>{},
TypeError=>{},
SecurityError=>{},
robert@fussel /cygdrive/c/Temp
$
robert