See One-line web server in Ruby on dzone snippets for exactly as described…a one line web server in Ruby.