るりまサーチ

最速Rubyリファレンスマニュアル検索!
165件ヒット [101-165件を表示] (0.021秒)
トップページ > クエリ:caller_locations[x]

別のキーワード

  1. kernel caller
  2. _builtin caller
  3. kernel caller_locations
  4. _builtin caller_locations
  5. caller _builtin

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 >>

Thread#backtrace_locations(start = 0, length = nil) -> [Thread::Backtrace::Location] | nil (6.0)

スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。

...数を指定します。

@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。

Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。

//emlist[例][ruby]{
thread = Thread.new { sleep 1 }...

Thread::Backtrace::Location#absolute_path -> String (6.0)

self が表すフレームの絶対パスを返します。

...の絶対パスを返します。

//emlist[例][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.r...

Thread::Backtrace::Location#base_label -> String (6.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...たもので構成
されます。

//emlist[例][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.base_label
end

# => initialize
# new
# <main>
//}

@see Thread::Backtrac...

Thread::Backtrace::Location#inspect -> String (6.0)

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).locations.map do |call|
puts call.inspect
end

# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:i...

Thread::Backtrace::Location#path -> String (6.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#to_s -> String (6.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...した文字列を返し
ます。

//emlist[例][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.to_s
end

# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `ne...
<< < 1 2 >>