るりまサーチ

最速Rubyリファレンスマニュアル検索!
77件ヒット [1-77件を表示] (0.182秒)
トップページ > クエリ:I[x] > クエリ:a[x] > クエリ:Location[x] > 種類:モジュール関数[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. ipaddr to_i

検索結果

ObjectSpace.#trace_object_allocations { ... } (21301.0)

与えられたブロック内でオブジェクトのトレースを行います。 

...のトレースを行います。 

//emlist[例][ruby]{
require 'objspace'

class C
i
nclude ObjectSpace

def foo
trace_object_allocations do
obj = Object.new
p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}"
end
end
end

C.new.foo #=> "objtrace.rb:8"
//}...

ObjectSpace.#trace_object_allocations_start -> nil (21301.0)

オブジェクト割り当てのトレースを開始します。

...オブジェクト割り当てのトレースを開始します。

@see ObjectSpace.#trace_object_allocations_stop...

ObjectSpace.#trace_object_allocations_stop -> nil (21301.0)

オブジェクト割り当てのトレースを終了します。

...オブジェクト割り当てのトレースを終了します。

トレースを終了する為には、ObjectSpace.#trace_object_allocations_startを呼んだ回数分だけこのメソッドを呼ぶ必要があります。

@see ObjectSpace.#trace_object_allocations_start...

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (18525.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...ムを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@param range 取得...
...ange オブジェクトを指定します。

//emlist[例][ruby]{
def test1(start, length)
location
s = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(sta...
...end

caller_locations # => []
test3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `te...

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (18525.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...ムを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@param range 取得...
...ange オブジェクトを指定します。

//emlist[例][ruby]{
def test1(start, length)
location
s = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(sta...
...end

caller_locations # => []
test3(1, nil)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'", "/Users/user/test.rb:17:in `<main>'"]
# => [9, 13, 17]
# => ["/Users/user/test.rb", "/Users/user/test.rb", "/Users/user/test.rb"]
test3(1, 2)
# => ["/Users/user/test.rb:9:in `te...

絞り込み条件を変える

ObjectSpace.#allocation_sourcefile(object) -> String (18301.0)

objectの元となったソースファイル名を返します。

...スファイル名を返します。

@param object 元となるソースファイル名を取得したいobjectを指定します。
@return objectの元となるソースファイル名を返します。存在しない場合はnilを返します。

//emlist[例:test.rbというファイルで下...
...require 'objspace'

ObjectSpace::trace_object_allocations_start
obj = Object.new
puts "file:#{ObjectSpace::allocation_sourcefile(obj)}" # => file:test.rb
ObjectSpace::trace_object_allocations_stop
//}

@see ObjectSpace.#trace_object_allocations_start,
ObjectSpace.#trace_object_allocations_st...

ObjectSpace.#allocation_sourceline(object) -> Integer (18301.0)

objectの元となったソースファイルの行番号を返します。

...param object 元となるソースファイルの行番号を取得したいobjectを指定します。
@return objectの元となるソースファイルの行番号を返します。存在しない場合はnilを返します。

//emlist[例][ruby]{
require 'objspace'

ObjectSpace::trace_object_al...
...locations_start
obj = Object.new
puts "line:#{ObjectSpace::allocation_sourceline(obj)}" # => line:4
ObjectSpace::trace_object_allocations_stop
//}

@see ObjectSpace.#trace_object_allocations_start,
ObjectSpace.#trace_object_allocations_stop...