Interactive Ruby Shell


Interactive Ruby Shell is a REPL for programming in the object-oriented scripting language Ruby. The abbreviation irb is a portmanteau of the word "interactive" and the filename extension for Ruby files, ".rb".
The program is launched from a command line and allows the execution of Ruby commands with immediate response, experimenting in real-time. It features command history, line editing capabilities, and job control, and is able to communicate directly as a shell script over the Internet and interact with a live server. It was developed by Keiju Ishitsuka.

Syntax and use

Syntax:
irb
Example:

irb:001:0> n = 5
=> 5
irb:002:0> def fact
irb:003:1> if n <= 1
irb:004:2> 1
irb:005:2> else
irb:006:2* n * fact
irb:007:2> end
irb:008:1> end
=> :fact
irb:009:0> fact
=> 120
irb:001:0> class Cat
irb:002:1> def meow
irb:003:2> puts 'The cat meows.'
irb:004:2> end
irb:005:1> end
=> :meow
irb:006:0> Cat.new.meow
The cat meows.