Tuesday, May 26, 2015

irb introduction

Interactive Ruby or irb is an interactive programming environment that comes with Ruby. 

Usage Syntax:

To invoke it, type irb at a shell or command prompt, and begin entering Ruby statements and expressions. Use exit or quit to exit irb.

$ irb[.rb] [options] [programfile] [arguments]

Here is a complete list of options:

-f                              Suppress reading of the file ~/.irbrc.
-m                             bc mode (load mathn library so fractions or matrix are available).
-d                              Set $DEBUG to true (same as ruby -d).
-r                               load-module Same as ruby -r.
-I                               path Specify $LOAD_PATH directory.
--inspect                   Use inspect for output (default except for bc mode).
--noinspect               Don't use inspect for output.
--readline                 Use Readline extension module.
--noreadline             Don't use Readline extension module.
--prompt                   prompt-mode (--prompt-mode prompt-mode) Switch prompt mode.

                                 Predefined prompt modes are default, simple, xmp, and inf-ruby.
--inf-ruby-mode         Use prompt appropriate for inf-ruby-mode on Emacs. Suppresses --readline.
--simple-prompt        Simple prompt mode.
--noprompt                No prompt mode.
--tracer                      Display trace for each execution of commands.
--back-trace-limit n    Display backtrace top n and tail n. The default value is 16.
--irb_debug n             Set internal debug level to n (not for popular use).
-v(--version).             Print the version of irb.