Wikipedia

Interactive Ruby Shell

Also found in: Acronyms.
Interactive Ruby Shell
Screenshot
Interactive Ruby Shell.png
The screenshot session as same as the article example
Developer(s)Keiju Ishitsuka
Stable release
1.2.4 / May 2, 2020 (2020-05-02)[1]
Repository Edit this at Wikidata
Written inRuby
Operating systemCross-platform
PlatformRuby interpreter
TypeRuby shell
LicenseRuby License
BSD License
Websitewww.ruby-lang.org/en/

Interactive Ruby Shell (IRB or irb) 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 [ options ] [ programfile ] [ argument... ] 

Example:

irb(main):001:0> n = 5 => 5 irb(main):002:0> def fact(n) irb(main):003:1>  if n <= 1 irb(main):004:2>  1 irb(main):005:2>  else irb(main):006:2*  n * fact(n - 1) irb(main):007:2>  end irb(main):008:1> end => :fact irb(main):009:0> fact(n) => 120 irb(main):001:0> class Cat irb(main):002:1>  def meow irb(main):003:2>  puts 'Meow!' irb(main):004:2>  end irb(main):005:1> end => :meow irb(main):006:0> Cat.new.meow Meow! 

See also

References

  1. ^ "All versions of irb". RubyGems.org. Retrieved 2020-07-06.

External links


This article is copied from an article on Wikipedia® - the free encyclopedia created and edited by its online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of Wikipedia® encyclopedia articles provide accurate and timely information, please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.

Copyright © 2003-2025 Farlex, Inc Disclaimer
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional.