るりまサーチ (Ruby 3.1)

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

別のキーワード

  1. optionparser on
  2. optparse on
  3. tracer on
  4. _builtin abort_on_exception
  5. _builtin abort_on_exception=

ライブラリ

検索結果

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

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

...uby]{
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_allocatio...

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

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

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

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

class C
include ObjectSpace

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