るりまサーチ

最速Rubyリファレンスマニュアル検索!
171件ヒット [1-100件を表示] (0.051秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Fiber#raise(exception, message = nil, backtrace = nil) -> object (18240.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...ram 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 (15154.0)

トレース (trace) を返します。

...トレース (trace) を返します。

行列のトレース (trace) とは、対角要素の和です。

//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6], [3,9]].trace # => 16
//}

trace
は正方行列でのみ定義されます。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が...

TracePoint#raised_exception -> Exception (9143.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] (6219.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_mon...
...th(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 `blo...
...ck in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}

@see Exception#backtrace...

Exception#set_backtrace(errinfo) -> nil | String | [String] (6125.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] (6119.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#instruction_sequence -> RubyVM::InstructionSequence (3219.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

...イルされた
Ruby
VM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
Trace
Point.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("puts 'hello'")
end
//}

@raise RuntimeError :sc...

TracePoint#callee_id -> Symbol | nil (3031.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 (3031.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...

TracePoint#lineno -> Integer (3031.0)

発生したイベントの行番号を返します。

...発生したイベントの行番号を返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace
= TracePoint.new(:call, :return) do |tp|
tp.lineno
end
trace
.enable
foo 1
# => 1
# 3
//}...

絞り込み条件を変える

<< 1 2 > >>