And this one ? :

============================================================
def c(letter)
  ("ABCDEF"[letter]&&"A")||("GHIJKL"[letter]&&"B")||
  ("MNOPQR"[letter]&&"C")||("STUVWXYZ"[letter]&&"D")||letter
end

loop {
   print "Word ? "
   str=STDIN.gets.chomp
   break if str.size==0
   puts str.upcase.each_char.map {|letter| c(letter)}.join("")
}
============================================================

-- 
Posted via http://www.ruby-forum.com/.