mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* irb 0.9(doc)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
af064b04b1
commit
1f6f2325f8
2 changed files with 75 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
|||
irb -- interactive ruby
|
||||
$Release Version: 0.5 $
|
||||
$Release Version: 0.9 $
|
||||
$Revision$
|
||||
$Date$
|
||||
by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||
|
@ -48,7 +48,12 @@ is the standard default action if Readline is installed.
|
|||
-f suppress read ~/.irbrc
|
||||
-m bc mode (fraction or matrix are available)
|
||||
-d set $DEBUG to true (same as `ruby -d')
|
||||
-Kc same as `ruby -Kc'
|
||||
-r load-module same as `ruby -r'
|
||||
--verbose command input is echoed(default)
|
||||
--noverbose command input isn't echoed
|
||||
--echo commands are echoed immediately before execution(default)
|
||||
--noecho commands aren't echoed immediately before execution
|
||||
--inspect uses `inspect' for output (the default except bc mode)
|
||||
--noinspect doesn't uses inspect for output
|
||||
--readline uses Readline extension module
|
||||
|
@ -56,7 +61,7 @@ is the standard default action if Readline is installed.
|
|||
--prompt prompt-mode
|
||||
--prompt-mode prompt-mode
|
||||
switches prompt mode. Pre-defined prompt modes are
|
||||
`deflaut', `simple', `xmp' and `inf-ruby'
|
||||
`default', `simple', `xmp' and `inf-ruby'
|
||||
|
||||
--inf-ruby-mode uses prompt appreciate for inf-ruby-mode on emacs.
|
||||
Suppresses --readline.
|
||||
|
@ -69,8 +74,6 @@ is the standard default action if Readline is installed.
|
|||
--irb_debug n sets internal debug level to n (It shouldn't be used)
|
||||
-v, --version prints the version of irb
|
||||
|
||||
|
||||
|
||||
= Configurations
|
||||
|
||||
irb reads `~/.irbrc' when it is invoked. If `~/.irbrb' doesn't exist
|
||||
|
@ -160,12 +163,17 @@ For irb commands, both simple name and `irb_'-prefixed name are prepared.
|
|||
|
||||
--- exit, quit, irb_exit
|
||||
Quits (sub)irb.
|
||||
if you've done cb (see below), exit from the binding mode.
|
||||
|
||||
--- conf, irb_context
|
||||
Displays current configuration. Modifing the configuration is
|
||||
achieved by sending message to `conf'.
|
||||
|
||||
--- conf.eval_history = N
|
||||
Sets execution result history.
|
||||
N is a integer or nil. If N > 0, the number of historys is N.
|
||||
If N == 0, the number of historys is unlimited. If N is nill,
|
||||
execution result history isn't used(default).
|
||||
|
||||
--- conf.back_trace_limit
|
||||
Sets display lines of backtrace as top n and tail n.
|
||||
The default value is 16.
|
||||
|
@ -193,9 +201,6 @@ For irb commands, both simple name and `irb_'-prefixed name are prepared.
|
|||
nil: inspect mode in non math mode,
|
||||
non inspect mode in math mode.
|
||||
|
||||
--- conf.irb_level
|
||||
The level of cb.
|
||||
|
||||
--- conf.math_mode
|
||||
Whether bc mode or not.
|
||||
|
||||
|
@ -223,13 +228,19 @@ For irb commands, both simple name and `irb_'-prefixed name are prepared.
|
|||
true: uses
|
||||
false: doen't use
|
||||
nil: intends to use readline except for inf-reuby-mode (default)
|
||||
#
|
||||
#--- conf.verbose=T/F
|
||||
# Whether verbose messages are display or not.
|
||||
|
||||
--- conf.verbose=T/F
|
||||
Whether verbose messages are display or not.
|
||||
--- cws, chws, irb_change_workspace [obj]
|
||||
obj will be self. If obj is omitted, self will be home-object, or
|
||||
the main object of first started irb.
|
||||
|
||||
--- cb, irb_change_binding [obj]
|
||||
Enter new binding which has a distinct scope of local variables.
|
||||
If obj is given, obj will be self.
|
||||
--- pushws, irb_pushws, irb_push_workspace [obj]
|
||||
same as UNIX-shell command pushd.
|
||||
|
||||
--- popws, irb_popws, irb_pop_workspace
|
||||
same as UNIX-shell command popd
|
||||
|
||||
--- irb [obj]
|
||||
Invoke subirb. If obj is given, obj will be self.
|
||||
|
@ -248,10 +259,20 @@ For irb commands, both simple name and `irb_'-prefixed name are prepared.
|
|||
--- kill n, irb_kill n
|
||||
Kill subirb. The means of n is as same as the case of irb_fg.
|
||||
|
||||
--- souce, irb_source path
|
||||
This is a like UNIX-shell command source. evaluate script in path
|
||||
on current context.
|
||||
|
||||
--- irb_load path, prev
|
||||
irb-version of Ruby's load.
|
||||
|
||||
= System variable
|
||||
|
||||
_ The latest value of evaluation (it is local)
|
||||
|
||||
--- _ The latest value of evaluation (it is local)
|
||||
--- __ The history of evaluation values.
|
||||
__[line_no] return an evaluation value of line number<line_no>. If
|
||||
line_no is a negative, return value before -<line_no> from latest
|
||||
value.
|
||||
|
||||
= Session Example
|
||||
|
||||
|
|
|
@ -1,23 +1,19 @@
|
|||
irb -- interactive ruby
|
||||
$Release Version: 0.6 $
|
||||
$Release Version: 0.9 $
|
||||
$Revision$
|
||||
$Date$
|
||||
by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||
=begin
|
||||
= irbとは?
|
||||
|
||||
irbはinteractive rubyの略です. rubyの式を標準入力から簡単に入力/実行す
|
||||
るためのツールです.
|
||||
irbはinteractive rubyの略です. rubyの式を標準入力から簡単に入力/実行する
|
||||
ためのツールです.
|
||||
|
||||
= 起動
|
||||
|
||||
% ruby -r irb -e0
|
||||
% irb
|
||||
|
||||
のいずれかで行ないます. 前者の場合irbへのオプション指定は, 以下のように
|
||||
なります.
|
||||
|
||||
% ruby -r irb -e0 -- -v
|
||||
で行ないます.
|
||||
|
||||
= 使い方
|
||||
|
||||
|
@ -47,7 +43,12 @@ irb
|
|||
-f ~/.irbrc を読み込まない.
|
||||
-m bcモード(分数, 行列の計算ができる)
|
||||
-d $DEBUG をtrueにする(ruby -d と同じ)
|
||||
-Kc ruby -Kcと同じ
|
||||
-r load-module ruby -r と同じ.
|
||||
--verbose これから実行する行を表示する(デフォルト)
|
||||
--noverbose これから実行する行を表示しない
|
||||
--echo 実行結果を表示する(デフォルト)
|
||||
--noecho 実行結果を表示しない
|
||||
--inspect 結果出力にinspectを用いる(bcモード以外はデフォルト).
|
||||
--noinspect 結果出力にinspectを用いない.
|
||||
--readline readlineライブラリを利用する.
|
||||
|
@ -168,13 +169,17 @@ irb
|
|||
--- exit, quit, irb_exit
|
||||
終了する.
|
||||
サブirbの場合, そのサブirbを終了する.
|
||||
cbしている場合, そのバインディングのモードを終了する.
|
||||
|
||||
--- conf, irb_context
|
||||
irbの現在の設定を表示する. 設定の変更は, confにメッセージを送るこ
|
||||
とによって行なえる.
|
||||
|
||||
--- conf.back_trace_limit
|
||||
--- conf.eval_history = N
|
||||
実行結果のヒストリ機能の設定.
|
||||
nnは整数かnilで nn>0 であればその数だけヒストリにためる。nn==0の時は
|
||||
無制限に記憶する、nilだとヒストリ機能はやめる(デフォルト).
|
||||
|
||||
--- Conf.back_trace_limit
|
||||
バックトレース表示をバックトレースの頭からn, 後ろからnだけ行なう.
|
||||
デフォルトは16
|
||||
|
||||
|
@ -201,9 +206,6 @@ irb
|
|||
nil: 通常モードであれば, inspect modeとなり, mathモードの時は, non
|
||||
inspect modeとなる.
|
||||
|
||||
--- conf.irb_level
|
||||
参照のみ. irbが何段cbしているか?
|
||||
|
||||
--- conf.math_mode
|
||||
参照のみ. bcモード(分数, 行列の計算ができます)かどうか?
|
||||
|
||||
|
@ -232,13 +234,19 @@ irb
|
|||
false: readlineを使わない.
|
||||
nil: (デフォルト)inf-reuby-mode以外でreadlineライブラリを利用しよ
|
||||
うとする.
|
||||
#
|
||||
#--- conf.verbose=T/F
|
||||
# irbからいろいろなメッセージを出力するか?
|
||||
|
||||
--- conf.verbose=T/F
|
||||
irbからいろいろなメッセージを出力するか?
|
||||
--- cws, chws, irb_cws, irb_chws, irb_change_workspace [obj]
|
||||
objをselfとする. objが省略されたときは, home workspace, すなわち
|
||||
irbを起動したときのmain objectをselfとする.
|
||||
|
||||
--- cb, irb_change_binding [obj]
|
||||
ローカル変数のスコープが違う新たなbindingに移る. objが指定された
|
||||
時は, そのobjをselfとする.
|
||||
--- pushws, irb_pushws, irb_push_workspace [obj]
|
||||
UNIXシェルコマンドのpushdと同様.
|
||||
|
||||
--- popws, irb_popws, irb_pop_workspace
|
||||
UNIXシェルコマンドのpopdと同様.
|
||||
|
||||
--- irb [obj]
|
||||
サブirbを立ちあげる. objが指定された時は, そのobjをselfとする.
|
||||
|
@ -257,10 +265,22 @@ irb
|
|||
--- kill n, irb_kill n
|
||||
サブirbをkillする. nはfgと同じ.
|
||||
|
||||
--- souce, irb_source path
|
||||
UNIXシェルコマンドのsourceと似ている. 現在の環境上でpath内のスクリ
|
||||
プトを評価する.
|
||||
|
||||
--- irb_load path, prev
|
||||
|
||||
Rubyのloadのirb版.
|
||||
|
||||
= システム変数
|
||||
|
||||
_ 前の計算の実行結果を覚えている(ローカル変数).
|
||||
--- _
|
||||
前の計算の実行結果を覚えている(ローカル変数).
|
||||
___ __
|
||||
実行結果の履歴を覚えている.
|
||||
__[line_no]で、その行で実行した結果を得ることができる. line_noが負の
|
||||
時には、最新の結果から-line_no前の結果を得ることができる.
|
||||
|
||||
= 使用例
|
||||
|
||||
|
|
Loading…
Reference in a new issue