IRB(1) Ruby Programmer's Reference Guide IRB(1)
NAME
irb -- Interactive Ruby Shell
SYNOPSIS
irb [--version] [-dfm] [-I directory] [-r library] [--[no]inspect] [--[no]readline] [--prompt mode] [--prompt-mode mode] [--inf-ruby-mode]
[--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit n] [--irb_debug n] [--] [program_file] [argument ...]
DESCRIPTION
irb is the REPL(read-eval-print loop) environment for Ruby programs.
OPTIONS
--version Prints the version of irb.
-E external[:internal]
--encoding external[:internal]
Same as `ruby -E' . Specifies the default value(s) for external encodings and internal encoding. Values should be separated
with colon (:).
You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil.
-I path Same as `ruby -I' . Specifies $LOAD_PATH directory
-U Same as `ruby -U' . Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
-d Same as `ruby -d' . Sets $DEBUG to true.
-f Suppresses read of ~/.irbrc.
-h
--help Prints a summary of the options.
-m Bc mode (load mathn, fraction or matrix are available)
-r library Same as `ruby -r'. Causes irb to load the library using require.
--inspect Uses `inspect' for output (default except for bc mode)
--noinspect Doesn't use inspect for output
--readline Uses Readline extension module.
--noreadline Doesn't use Readline extension module.
--prompt mode
--prompt-mode mode
Switch prompt mode. Pre-defined prompt modes are `default', `simple', `xmp' and `inf-ruby'.
--inf-ruby-mode
Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses --readline.
--simple-prompt
Makes prompts simple.
--noprompt No prompt mode.
--tracer Displays trace for each execution of commands.
--back-trace-limit n
Displays backtrace top n and tail n. The default value is 16.
--irb_debug n Sets internal debug level to n (not for popular use)
ENVIRONMENT
IRBRC
Also irb depends on same variables as ruby(1).
FILES
~/.irbrc Personal irb initialization.
EXAMPLES
% irb
irb(main):001:0> 1 + 1
2
irb(main):002:0> def t(x)
irb(main):003:1> x+1
irb(main):004:1> end
=> nil
irb(main):005:0> t(3)
=> 4
irb(main):006:0> if t(3) == 4
irb(main):007:1> p :ok
irb(main):008:1> end
:ok
=> :ok
irb(main):009:0> quit
%
SEE ALSO
ruby(1).
REPORTING BUGS
o Security vulnerabilities should be reported via an email to security@ruby-lang.org. Reported problems will be published after being
fixed.
o Other bugs and feature requests can be reported via the Ruby Issue Tracking System (http://bugs.ruby-lang.org). Do not report security
vulnerabilities via this system because it publishes the vulnerabilities immediately.
AUTHORS
Written by Keiju ISHITSUKA.
UNIX
November 15, 2012 UNIX
Check Out this Related Man Page
libcaca-ruby-api(3caca) libcaca libcaca-ruby-api(3caca)
NAME
libcaca-ruby-api - Libcaca Ruby API
Classes
The classes available for libcaca are :
o Caca::Canvas : functions that have a caca_canvas_t* as first argument
o Caca::Dither : functions that have a caca_dither_t* as first argument
o Caca::Font : functions that have a caca_font_t* as first argument (The constructor can currently only accept the name of a builtin font)
o Caca::Display
o Caca::Event
o Caca::Event::Key
o Caca::Event::Key::Press
o Caca::Event::Key::Release
o Caca::Event::Mouse
o Caca::Event::Mouse::Press
o Caca::Event::Mouse::Release
o Caca::Event::Mouse::Motion
o Caca::Event::Resize
o Caca::Event::Quit
The character set conversion functions are not available yet in the binding.
$ irb -rcaca
irb(main):001:0> class Object
irb(main):002:1> def Object.my_instance_methods
irb(main):003:2> instance_methods.sort - ancestors[1].instance_methods
irb(main):004:2> end
irb(main):005:1> def Object.my_methods
irb(main):006:2> methods.sort - ancestors[1].methods
irb(main):007:2> end
irb(main):008:1> end
irb(main):009:0> Caca.constants
=> ['BROWN', 'BOLD', 'GREEN', 'LIGHTMAGENTA', 'LIGHTBLUE', 'BLINK',
irb(main):010:0> Caca.my_methods
=> ['version']
irb(main):011:0> Caca::Canvas.my_methods
=> ['export_list', 'import_list']
irb(main):012:0> Caca::Canvas.my_instance_methods
=> ['attr=', 'blit', 'clear', 'create_frame',
irb(main):013:0> Caca::Font.my_methods
=> ['list']
irb(main):014:0> Caca::Font.my_instance_methods
=> ['blocks', 'height', 'width']
irb(main):015:0> Caca::Dither.my_instance_methods
=> ['algorithm=', 'algorithm_list', 'antialias=', 'antialias_list',
irb(main):010:0> Caca::Display.my_instance_methods
=> ['canvas', 'get_event', 'height', 'mouse=', 'mouse_x', 'mouse_y', 'refresh',
irb(main):011:0> Caca::Event.constants
=> ['Key', 'Quit', 'TYPE', 'Mouse', 'Resize']
irb(main):012:0> Caca::Event.my_instance_methods
=> ['quit?']
irb(main):013:0> Caca::Event::Key.my_instance_methods
=> ['ch', 'utf32', 'utf8']
irb(main):014:0> Caca::Event::Mouse.my_instance_methods
=> ['button', 'x', 'y']
irb(main):015:0> Caca::Event::Resize.my_instance_methods
=> ['w', 'h']
Samples
$ ruby -rcaca -e 'c=Caca::Canvas.new(6, 3).fill_box(0,0,2,2,'#'[0]);
c2=Caca::Canvas.new(1,1).put_str(0,0,'x'); c.blit(1,1,c2); puts
c.export_to_memory('irc')'
###
#x#
###
$ ruby -e 'puts Caca::Canvas.new(6,3).draw_thin_polyline([[0,0], [0,2],
[5,2],[0,0]]).export_to_memory('irc')'
-.
| `.
----`-
$ ruby -rcaca -e 'p Caca::Canvas.export_list'
[['caca', 'native libcaca format'], ['ansi', 'ANSI'], ['utf8', 'UTF-8
withANSI escape codes'], ['utf8cr', 'UTF-8 with ANSI escape codes and
MS-DOS
'], ['html', 'HTML'], ['html3', 'backwards-compatible HTML'],
['irc', 'IRC with mIRC colours'], ['ps', 'PostScript document'], ['svg',
$ ruby -rcaca -e 'p Caca::Font.list'
['Monospace9', 'Monospace Bold 12']
require 'caca'
c = Caca::Canvas.new(20,10)
c.put_str(2,3, 'plop!')
c.draw_thin_polyline([[0,0],[0,2], [5,2], [0,0]])
d = Caca::Display.new(c)
d.title= 'Test !'
d.refresh
#Redefine Event::Key#quit? so that q, Q, and Esc become exit keys
module Caca
class Event::Key
def quit?
'qQ^['.split('').member?(@ch.chr)
end
end
end
while((e= d.get_event(Caca::Event, -1)) && ! e.quit?)
p e
d.refresh
end
Version 0.99.beta18 Fri Apr 6 2012 libcaca-ruby-api(3caca)