184件ヒット
[1-100件を表示]
(0.082秒)
ライブラリ
- ビルトイン (159)
- matrix (24)
-
minitest
/ unit (1)
クラス
- Exception (36)
- Fiber (6)
- Matrix (24)
- Thread (12)
- TracePoint (105)
モジュール
キーワード
- backtrace (12)
-
backtrace
_ locations (12) -
callee
_ id (12) -
eval
_ script (7) - event (12)
-
instruction
_ sequence (7) - lineno (12)
-
method
_ id (12) - parameters (7)
- path (12)
-
raised
_ exception (12) -
return
_ value (12) -
set
_ backtrace (12) - skip (1)
- tr (12)
検索結果
先頭5件
-
Thread
# raise(error _ type , message , traceback) -> () (18226.0) -
自身が表すスレッドで強制的に例外を発生させます。
...させます。
@param error_type Kernel.#raise を参照してください。
@param message Kernel.#raise を参照してください。
@param traceback Kernel.#raise を参照してください。
Thread.new {
sleep 1
Thread.main.raise "foobar"
}
begin
sleep
rescue
p... -
Fiber
# raise(exception , message = nil , backtrace = nil) -> object (18216.0) -
selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。
...す。
@param exception 発生させる例外です。
@param backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。
//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}
//emlist[ファイバー内......のイテレーションを終了させる例][ruby]{
f = Fiber.new do
loop do
Fiber.yield(:loop)
end
:exit
end
p f.resume # => :loop
p f.raise StopIteration # => :exit
//}... -
Matrix
# trace -> Integer | Float | Rational | Complex (15142.0) -
トレース (trace) を返します。
...トレース (trace) を返します。
行列のトレース (trace) とは、対角要素の和です。
//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}
trace は正方行列でのみ定義されます。
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が... -
TracePoint
# raised _ exception -> Exception (9131.0) -
発生した例外を返します。
...ます。
@raise RuntimeError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
begi... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (6207.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...バックトレース情報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require......ong_month(month)
return if Date.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... -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (6113.0) -
バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。
...定します。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.set_backtrace(["dummy1", "dummy2"])
$!.backtrace # => ["dummy1", "dummy2"]
end
//}... -
Exception
# backtrace -> [String] (6107.0) -
バックトレース情報を返します。
...)
* "#{sourcefile}:#{sourceline}"
(トップレベルの場合)
という形式の String の配列です。
//emlist[例][ruby]{
def methd
raise
end
begin
methd
rescue => e
p e.backtrace
end
#=> ["filename.rb:2:in `methd'", "filename.rb:6"]
//}
@see Exception#backtrace_locations... -
TracePoint
# callee _ id -> Symbol | nil (3019.0) -
イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。
...@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end
trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
end
trace.enab......le do
C.new.alias_name
end
//}
@see TracePoint#method_id... -
TracePoint
# event -> Symbol (3019.0) -
発生したイベントの種類を Symbol で返します。
...細については、TracePoint.new を参照してくださ
い。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call, :return) do |tp|
p tp.event
end
trace.enable
foo 1
# => :call...