irb is an abbreviation for interactive ruby. It is a tool to easily input / execute ruby expressions from standard input. by official
You can run ruby line by line on the terminal using the command irb from the terminal. It is a very powerful tool when you want to try ruby easily.
You don't have to create a file every time, which is very convenient when you want to execute a little ruby command.
Easy to install with gem.
$ gem install irb
Fetching irb-1.2.7.gem
Fetching io-console-0.5.6.gem
Fetching reline-0.1.8.gem
Building native extensions. This could take a while...
Successfully installed io-console-0.5.6
Successfully installed reline-0.1.8
Successfully installed irb-1.2.7
Parsing documentation for io-console-0.5.6
Installing ri documentation for io-console-0.5.6
Parsing documentation for reline-0.1.8
Installing ri documentation for reline-0.1.8
Parsing documentation for irb-1.2.7
Installing ri documentation for irb-1.2.7
Done installing documentation for io-console, reline, irb after 2 seconds
3 gems installed
After installing, just type irb.
$ irb
irb(main):001:0>
For example, use the puts command to display Hello, world.
irb(main):001:0> puts "Hello, world!"
Hello, world!
=> nil
irb(main):002:0>
It's easy. It's easier than creating a ruby file and running ruby from the ruby command.
Type exit and press Enter to return to the normal terminal.
irb(main):001:0> exit
$
Recommended Posts