種類
- インスタンスメソッド (229)
- 文書 (52)
- 特異メソッド (49)
- ライブラリ (33)
- モジュール関数 (22)
ライブラリ
- ビルトイン (212)
-
irb
/ context (11) -
json
/ add / exception (11) - mkmf (22)
-
net
/ smtp (22) -
rake
/ rdoctask (11)
クラス
- Exception (40)
-
IRB
:: Context (11) - Module (7)
-
Net
:: SMTP (22) - Object (11)
-
RDoc
:: Options (11) -
Rake
:: RDocTask (11) -
RubyVM
:: InstructionSequence (66) - Thread (38)
-
Thread
:: Backtrace :: Location (33) - TracePoint (6)
モジュール
- Kernel (44)
キーワード
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (3) - autoload (7)
-
backtrace
_ locations (33) -
base
_ label (22) -
caller
_ locations (22) -
compile
_ file (11) - disasm (11)
- disassemble (11)
- ehlo (11)
- helo (11)
- inspect (11)
-
instruction
_ sequence (6) - irb (11)
-
irb
/ completion (11) - label (11)
-
main
_ page (11) - rdoc (11)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) -
respond
_ to? (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
set
_ backtrace (11) -
to
_ a (11) -
to
_ json (11) -
to
_ s (11) -
try
_ link (22) - 正規表現 (11)
検索結果
先頭5件
-
IRB
:: Context # main -> object (21201.0) -
self に設定されたオブジェクトを返します。
self に設定されたオブジェクトを返します。
@see cwws コマンド -
Thread
. report _ on _ exception -> bool (12338.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...derr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉でき......oin や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが遅れたり、親......いて
終了を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを... -
Thread
. report _ on _ exception=(newstate) (12238.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...derr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉でき......oin や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレポートを無効化しても
安全です。しかし、この場合、例外をハンドルするのが遅れたり、親......いて
終了を待つことができなかったりするかもしれません。
スレッドごとに設定する方法は Thread#report_on_exception= を参照してください。
@param newstate スレッド実行中に例外発生した場合、その内容を報告するかどうかを... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9318.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return......te.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb......:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
RDoc
:: Options # main _ page -> String | nil (9217.0) -
コマンドライン引数の --main オプションで指定したファイル名、クラス/モ ジュール名を返します。
...コマンドライン引数の --main オプションで指定したファイル名、クラス/モ
ジュール名を返します。
指定しなかった場合は nil を返します。... -
Exception
# to _ json(*args) -> String (9206.0) -
自身を JSON 形式の文字列に変換して返します。
...身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡され......ます。
//emlist[例][ruby]{
require "json/add/core"
begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivisionError\",\"m\":\"divided by 0\",\"b\":[\"/path/to/test.rb:4:in `/'\",\"/path/to/test.rb:4:in `<main>'\"]}"
end
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (6306.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/Us......ers/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 1... -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6306.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@pa......def test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/Us......ers/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 1... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (6306.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します......rnel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thre......ad::Backtrace::Location... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (6306.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します......rnel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thre......ad::Backtrace::Location...