From: Lloyd Zusman Date: 2003-05-15T01:17:10+09:00 Subject: Re: ruby_run() w/o exit? "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> writes: > I know you asked for C.. and that I replyed with C++ :-) > > -- > Simon Strandgaard > > > BTW: I fixed your class so that it works correctly now. And now I have fixed the class so that it now works when you rank a language whose name doesn't end with plus sign ... and I assume that giving a rank of zero to a language means that it's the ultimate. class Howard class TooPainFulError < StandardError; end def initialize @langs = %w(ruby c perl java idl bash sh zsh tcsh csh fortran c++) end def rank lang ## Incorrect line replaced: ## raise NotImplementedError, lang unless @langs.index lang raise NotImplementedError, lang unless (i = @langs.index lang) case lang when /[^+]$/ puts "#{lang} is my ##{i} ranked language" else raise TooPainFulError, lang end end end ara = Howard.new ara.rank "c++" ara.rank "c" ara.rank "ruby" -- Lloyd Zusman ljz@asfast.com