Re: the most useful code i've written in a while
- From: "Sean O'Halpin" <sean.ohalpin@xxxxxxxxx>
- Date: Fri, 6 Apr 2007 23:12:51 +0900
On 4/6/07, Robert Klemme <shortcutter@xxxxxxxxxxxxxx> wrote:
On 06.04.2007 02:54, Trans wrote:
>
> On Apr 5, 5:34 pm, "Ara.T.Howard" <ara.t.how...@xxxxxxxx> 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
Nice! Small refinement for tree of Exceptions:
tree[cl.superclass][cl] = tree[cl] if cl <= Exception
Regards,
Sean
.
- References:
- the most useful code i've written in a while
- From: Ara.T.Howard
- Re: the most useful code i've written in a while
- From: Trans
- Re: the most useful code i've written in a while
- From: Robert Klemme
- the most useful code i've written in a while
- Prev by Date: Re: [QUIZ] Getting to 100 (#119)
- Next by Date: Re: Calculating Business Hours Left
- Previous by thread: Re: the most useful code i've written in a while
- Next by thread: Re: Run some method based on some condition
- Index(es):
Relevant Pages
|
|