O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

IRB

Interactive Ruby (IRB) is an interactive shell where you can try out your code or just play around. IRB comes in really handy to try out small pieces of code. For the rest of the chapter, you can try out the code examples in IRB or create files and execute them. In the examples, we will be doing both so that you can be comfortable using either.

Installation

IRB comes along with Ruby. So, installing Ruby will also install the correct irb.

Using IRB

Type irb on your command line to start the shell:

2.0.0-p195 :001 > puts "Hello World!"
Hello World!
 => nil

The => nil that you see is the return value of the statement executed. So you don't need to worry about it much.

You can run any valid Ruby code in irb. Use it to play around with objects and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required