12件ヒット
  
    
      [1-12件を表示]
    
  
    (0.776秒)
  
  
    トップページ > 
:Kernel.#p
 > 
:Array
 > 
:lambda
 > 
:public_instance_method
 > 
:rectangular
 > 
:exception
 > 
:egrep_cpp
 > 
:sysopen
 > クラス:TracePoint
  
ライブラリ
- ビルトイン (12)
 
検索結果
- 
      
TracePoint
# defined _ class -> Class | module (3031.0)  - 
      
      
      
メソッドを定義したクラスかモジュールを返します。
...メソッドを定義したクラスかモジュールを返します。
//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}
メソッドがモジュールで定義されていた場合も(include に......end
class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}
[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6 番目のブロッ......く元のクラスを返します。
//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}
Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。
@see 50864... 
