るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.020秒)
トップページ > ライブラリ:ビルトイン[x] > バージョン:2.3.0[x] > クエリ:*[x] > クエリ:backtrace[x]

別のキーワード

  1. _builtin *
  2. matrix *
  3. vector *
  4. array *
  5. bigdecimal *

クラス

検索結果

Exception#backtrace -> [String] (54382.0)

バックトレース情報を返します。

バックトレース情報を返します。

デフォルトでは

* "#{sourcefile}:#{sourceline}:in `#{method}'"
(メソッド内の場合)
* "#{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...

Thread::Backtrace::Location (9043.0)

Ruby のフレームを表すクラスです。

Ruby のフレームを表すクラスです。

Kernel.#caller_locations から生成されます。

//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end
def b(skip)
a(skip)
end
def c(skip)
b(skip)
end

c(0..2).map do |call|
puts call.to_s
end
//}

例1の実行結果:

caller_locations.rb:2:in `a'
caller_locations...