Interactive Ruby Shell: Difference between revisions

Content deleted Content added
+rcat
 
(One intermediate revision by one other user not shown)
Line 1:
#REDIRECT [[Category:Ruby (programming language)#Features]]
<!-- Please do not remove or change this AfD message until the discussion has been closed. -->
{{Article for deletion/dated|page=Interactive Ruby Shell|timestamp=20221106195809|year=2022|month=November|day=6|substed=yes}}
<!-- Once discussion is closed, please place on talk page: {{Old AfD multi|page=Interactive Ruby Shell|date=6 November 2022|result='''keep'''}} -->
<!-- End of AfD message, feel free to edit beyond this point -->
 
{{Rcat shell|
{{manual|date=August 2021}}
{{R to related topic}}
 
{{r hist}}
{{more citations needed|date=January 2021}}
{{Infobox software
| name = Interactive Ruby Shell
| logo =
| screenshot = [[Image:Interactive Ruby Shell.png|300px|]]
| caption = The screenshot session as same as the article example
| collapsible = yes
| developer = [[Keiju Ishitsuka]] <!--keiju@ishitsuka.com-->
| latest release version = 1.2.4
| latest release date = {{start date and age|2020|05|02}}<ref>{{cite web|url=https://rubygems.org/gems/irb/versions|title=All versions of irb|publisher=RubyGems.org|access-date=2020-07-06}}</ref>
| operating system = [[Cross-platform]]
| platform = [[Ruby (programming language)|Ruby interpreter]]
| programming language = [[Ruby (programming language)|Ruby]]
| genre = [[Ruby (programming language)|Ruby]] [[shell (computing)|shell]]
| license = [http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/COPYING?view=markup Ruby License]<br />[[BSD licenses|BSD License]]
| website = {{url|http://www.ruby-lang.org/en/}}
}}
 
'''Interactive Ruby Shell''' ('''IRB''' or '''irb''') is a [[REPL]] for programming in the [[Object-oriented programming|object-oriented]] [[scripting language]] [[Ruby (programming 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 interface|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 (Unix)|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:
<syntaxhighlight lang="irb">
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!
 
</syntaxhighlight>
 
==See also==
{{Portal|Free and open-source software}}
* [[Comparison of computer shells]]
 
== References ==
{{Reflist}}
 
==External links==
*[https://repl.it/languages/ruby "Code and run Ruby online"] A powerful interactive Ruby shell
*[https://ruby.github.io/TryRuby/ "Try Ruby"] Online IRB
*[http://ruby-doc.org/docs/ProgrammingRuby/html/trouble.html "When Trouble Strikes"] chapter from ''[[Programming Ruby]]''
*[http://ruby-doc.org/docs/ProgrammingRuby/html/irb.html "Interactive Ruby Shell"] chapter from ''[[Programming Ruby]]''
 
{{Ruby programming language}}
 
[[Category:Ruby (programming language)]]
[[Category:Interpreters (computing)]]
 
 
{{Compu-lang-stub}}