種類
- モジュール関数 (585)
- 変数 (372)
- インスタンスメソッド (192)
キーワード
-
$ & (12) -
$ & # 39; (12) -
$ 1 (12) -
$ 10 (12) -
$ 11 (12) -
$ 2 (12) -
$ 3 (12) -
$ 4 (12) -
$ 5 (12) -
$ 6 (12) -
$ 7 (12) -
$ 8 (12) -
$ 9 (12) -
$ ARGV (12) -
$ CHILD _ STATUS (12) -
$ DEFAULT _ INPUT (12) -
$ ERROR _ INFO (12) -
$ ERROR _ POSITION (12) -
$ INPUT _ LINE _ NUMBER (12) -
$ INPUT _ RECORD _ SEPARATOR (12) -
$ LAST _ MATCH _ INFO (12) -
$ LAST _ PAREN _ MATCH (12) -
$ LAST _ READ _ LINE (12) -
$ NR (12) -
$ ORS (12) -
$ OUTPUT _ RECORD _ SEPARATOR (12) -
$ RS (12) -
$ _ (12) -
$ ` (12) -
$ stdin (12) -
$ ~ (12) - DelegateClass (12)
- Digest (12)
- String (12)
-
_ _ callee _ _ (12) -
_ _ method _ _ (12) - abort (24)
-
at
_ exit (12) - autoload (12)
- autoload? (12)
- binding (12)
-
block
_ given? (12) - caller (36)
-
caller
_ locations (24) - catch (24)
-
depend
_ rules (12) - desc (12)
-
enable
_ config (24) - eval (24)
- exit (12)
- exit! (12)
- fail (36)
- file (12)
- fork (24)
- format (12)
- gets (12)
- iterator? (12)
- lambda (18)
- loop (24)
- namespace (12)
- print (12)
- proc (19)
- raise (36)
- readline (12)
- require (12)
-
require
_ relative (12) - rule (12)
-
set
_ trace _ func (12) - sleep (24)
- sprintf (12)
- task (12)
- test (24)
- throw (12)
-
try
_ cpp (24) -
try
_ link (24) - warn (8)
-
with
_ config (24)
検索結果
先頭5件
-
Kernel
# depend _ rules(depend) -> Array (6201.0) -
ファイルの依存関係の書かれた depend ファイルの内容を処理します。
...ファイルの依存関係の書かれた depend ファイルの内容を処理します。
@param depend depend ファイルの内容を指定します。
@return 見つかった依存関係を Makefile 形式で返します。... -
Kernel
. # at _ exit { . . . } -> Proc (49.0) -
与えられたブロックをインタプリタ終了時に実行します。
...与えられたブロックをインタプリタ終了時に実行します。
at_exitがメソッドである点を除けば、END ブロックによる終了
処理の登録と同等です。登録した処理を取り消すことはできません。
spec/terminateも参照してください。......Proc オブジェクトで返します。
//emlist[例][ruby]{
3.times do |i|
at_exit{puts "at_exit#{i}"}
end
END{puts "END"}
at_exit{puts "at_exit"}
puts "main_end"
#=> main_end
# at_exit
# END
# at_exit2
# at_exit1
# at_exit0
//}
@see d:spec/control#END,Kernel.#exit!,Kernel.#fork... -
Kernel
. # abort -> () (43.0) -
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
...Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
このメソッドと Kernel.#exit との違いは、プログラムの終了ステー
タスが 1 (正確にはCレベルの定数 EXIT_FAILURE の値)固定であることと、......stemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'end' #実行されない
#(標準出力)
#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステー......タス:1
#(標準エラー出力)
#=> error1
//}
@see Kernel.#exit,Kernel.#exit!......タス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}
@see Kernel.#exit,Kernel.#exit!... -
Kernel
. # abort(message) -> () (43.0) -
Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
...Ruby プログラムをエラーメッセージ付きで終了します。終了ステータスは 1 固定です。
このメソッドと Kernel.#exit との違いは、プログラムの終了ステー
タスが 1 (正確にはCレベルの定数 EXIT_FAILURE の値)固定であることと、......stemExit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
raise RuntimeError.new
rescue
abort
ensure
puts 'end2...'
end
puts 'end' #実行されない
#(標準出力)
#=> start
# start1...
# end1 with #<SystemExit: error1>
# start2...
# end2...
#終了ステー......タス:1
#(標準エラー出力)
#=> error1
//}
@see Kernel.#exit,Kernel.#exit!......タス:1
#(標準エラー出力)
#=> error1
# Traceback (most recent call last):
# sample.rb:11:in `<main>': RuntimeError (RuntimeError)
//}
@see Kernel.#exit,Kernel.#exit!... -
Kernel
. # caller(range) -> [String] | nil (43.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in......+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は......、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start = 1) -> [String] | nil (43.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in......+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は......、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start , length) -> [String] | nil (43.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in......+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は......、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # exit(status = true) -> () (43.0) -
Rubyプログラムの実行を終了します。status として整 数が与えられた場合、その値を Ruby コマンドの終了ステータスとします。 デフォルトの終了ステータスは 0(正常終了)です。
...xit => err
puts "end1 with #{err.inspect}"
end
begin
puts 'start2...'
exit
ensure
puts 'end2...'
end
puts 'end' #実行されない
#=> start
# start1...
# end1 with #<SystemExit: exit>
# start2...
# end2...
#終了ステータス:0
//}
@see Kernel.#exit!,Kernel.#abort, d:spec/con... -
Kernel
. # fail -> () (37.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...させます。
//emlist[例][ruby]{
begin
open("nonexist")
rescue
raise #=> `open': No such file or directory - "nonexist" (Errno::ENOENT)
end
//}
引数を渡した場合は、例外メッセージ message を持った error_type の示す例外(省略時 RuntimeError)を
発生させま......します。
@param message 例外のメッセージとなる文字列です。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@param cause 現在の例外($!)の代わりに Exception#cause に......r
ensure
p err #=> #<NameError: !!error!!>
end
//}
//emlist[例2][ruby]{
def foo num
print 'in method.'
raise "error!!" if num <= 9
rescue RuntimeError
num += 10
print 'in rescue.'
retry
else
print 'in else.'
ensure
print "in ensure.\n"
end
foo(4) #=> in method.in rescue.in method....