I know this doesn't directly answer your question, but see: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/51362 Also, check out the follow-up reply.