Linux Today: Linux News On Internet Time.

Code Project: Create a web server in Ruby

Mar 24, 2009, 06:02 (0 Talkback[s])

"Setting up
First off, you'll need to install the Ruby interpreter, which should be in your package manager's repositories. You'll also want to install Irb, the interactive Ruby interpreter, which is supplied in a separate package in some distros.

"Once these things have been installed, fire up an interactive Ruby session by entering irb at a shell prompt. This will pop up a prompt for you to start entering Ruby statements. It's almost law that every coding guide starts with a Hello World instruction, but we'll bend the rules a little here. Run

puts "Goodbye moon!"

"That's pretty self-explanatory - puts outputs the supplied string to the screen. However, one of the most crucial features of Ruby to note is that everything is an object. Yes, even literal strings. It's pretty weird, but it enables you to do things like:"

Complete Story

Related Stories: