From: Dave Bass Date: 2008-08-01T01:38:57+09:00 Subject: Re: Help me with this Numerology code please... Karl-Heinz Wild wrote: > On 31.07.2008, at 12:23, Sebastian Hungerecker wrote: > >> 1}.to_s.split(//).inject(0) {|s,x| s + x.to_i} >> => 3 > > Nice code! > > "RUBY".unpack("C*").inject(0) { |s,x| s + (x-64)%9 }%9 > => 3 > > whouldn't that be better? Obviously the harder to understand, the better. -- Posted via http://www.ruby-forum.com/.