326件ヒット
[1-100件を表示]
(0.144秒)
種類
- インスタンスメソッド (143)
- ライブラリ (121)
- モジュール関数 (22)
- クラス (22)
- 文書 (18)
ライブラリ
- ビルトイン (165)
-
rubygems
/ commands / which _ command (11) -
webrick
/ httpresponse (11)
クラス
- Exception (22)
- Thread (33)
-
Thread
:: Backtrace :: Location (77) -
WEBrick
:: HTTPResponse (11)
モジュール
- Kernel (22)
キーワード
- == (11)
- Location (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 3
. 0 . 0 (4) - Rubyの起動 (3)
- WhichCommand (11)
-
absolute
_ path (11) -
backtrace
_ locations (33) -
base
_ label (11) -
caller
_ locations (22) - inspect (11)
- label (11)
- lineno (11)
- path (11)
-
rubygems
/ commands / build _ command (11) -
rubygems
/ commands / environment _ command (11) -
rubygems
/ commands / generate _ index _ command (11) -
rubygems
/ commands / install _ command (11) -
rubygems
/ commands / list _ command (11) -
rubygems
/ commands / mirror _ command (11) -
rubygems
/ commands / pristine _ command (11) -
rubygems
/ commands / query _ command (11) -
rubygems
/ commands / search _ command (11) -
rubygems
/ commands / specification _ command (11) -
rubygems
/ commands / uninstall _ command (11) -
set
_ error (11) -
to
_ s (11)
検索結果
先頭5件
- Thread
# backtrace -> [String] | nil - Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] - Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil - Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil - Thread
:: Backtrace :: Location # inspect -> String
-
Thread
# backtrace -> [String] | nil (21213.0) -
スレッドの現在のバックトレースを返します。
...nil を返します。
//emlist[例][ruby]{
class C1
def m1
sleep 5
end
def m2
m1
end
end
th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] "(irb):10:in `block in irb......_binding'"
# ]
th.kill
th.backtrace # => nil
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (15552.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if D......0, 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... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (15532.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......cations と似ていますが、本メソッドは 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 Thread::Backtrace::......Location... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (15532.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......cations と似ていますが、本メソッドは 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 Thread::Backtrace::......Location... -
Thread
:: Backtrace :: Location # inspect -> String (12216.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).loc......ations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}... -
Thread
:: Backtrace :: Location # path -> String (12212.0) -
self が表すフレームのファイル名を返します。
...self が表すフレームのファイル名を返します。
例: Thread::Backtrace::Location の例1を用いた例
//emlist[][ruby]{
loc = c(0..1).first
loc.path # => "caller_locations.rb"
//}
@see Thread::Backtrace::Location#absolute_path... -
Thread
:: Backtrace :: Location # absolute _ path -> String (12206.0) -
self が表すフレームの絶対パスを返します。
...mlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Locatio......n#path... -
Thread
:: Backtrace :: Location # lineno -> Integer (12206.0) -
self が表すフレームの行番号を返します。
...self が表すフレームの行番号を返します。
例: Thread::Backtrace::Location の例1を用いた例
//emlist[][ruby]{
loc = c(0..1).first
loc.lineno # => 2
//}... -
Gem
:: Commands :: WhichCommand (12012.0) -
指定された Gem パッケージに含まれるライブラリのパスを見つけるためのクラスです。
...けるためのクラスです。
Usage: gem which FILE [...] [options]
Options:
-a, --[no-]all show all matching files
-g, --[no-]gems-first search gems before non-gems
Common Options:
-h, --help このコマンドの......[no-]verbose 表示を詳細にします
-q, --quiet 静かに実行します
--config-file FILE 指定された設定ファイルを使用します
--backtrace バックトレースを表示します
-......Ruby 自体のデバッグオプションを有効にします
Arguments:
FILE Gem パッケージ名を指定します
Summary:
指定された Gem パッケージのライブラリのある場所を表示します
Defaults:
--no-gems-first --no-all... -
Thread
:: Backtrace :: Location (12006.0) -
Ruby のフレームを表すクラスです。
...tions から生成されます。
//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.rb:5:in......f initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
//}
例2の実行結果:
init.rb:4:in `initialize'
init.rb:8:in `new'
init.rb:8:in `<main>'
=== 参考
* Ruby VM アドベントカレンダー #4 vm_backtrace.......c: https://www.atdot.net/~ko1/diary/201212.html#d4...