From: Matthias Reitinger Date: 2009-05-16T06:15:02+09:00 Subject: Re: [QUIZ] Big Words (#204) Daniel Moore wrote: > ## Big Words (#204) This quiz immediately reminded me of FIGlet[1]. A reimplementation of FIGlet in Ruby seemed to be a sensible way to solve this quiz, taking into account the hundreds of fonts already available in the FIGlet format (saving me from creating my own font). Fortunately I wasn't the first one to have that idea: the "Text" gem[2] includes a Ruby implementation of FIGlet! So I couldn't resist to do this: #!/usr/bin/env ruby require 'rubygems' require 'text' def big_word(str, fontfile='banner.flf') font = Text::Figlet::Font.new(fontfile) figlet = Text::Figlet::Typesetter.new(font) figlet[str] end if __FILE__ == $0 while str = ARGV.shift puts big_word(str) end end Sample run: reima@marvin:~/devel/ruby/quiz/204$ ./big_word.rb "Ruby Quiz" ###### ##### # # # # ##### # # # # # # # ###### # # # # # # # # # # # # # # ###### # # ##### # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #### ##### # #### # #### # ###### The font file needed to run the script can be obtained from [3]. Or pick any font from the font database[4] you fancy and change the file name in the script. -Matthias [1]: http://www.figlet.org/ [2]: http://text.rubyforge.org/ [3]: http://www.figlet.org/fonts/banner.flf [4]: http://www.figlet.org/fontdb.cgi