るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.040秒)
トップページ > バージョン:2.3.0[x] > クエリ:new[x] > クエリ:define[x] > クエリ:defined_class[x]

別のキーワード

  1. _builtin define_method
  2. mutex_m define_aliases
  3. rake define_task
  4. module define_method
  5. main define_method

ライブラリ

クラス

検索結果

TracePoint#defined_class -> Class | module (72766.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 に関係なく)モジュー
ルを返します。

//emlist[例][ruby]{
module M; def foo; end; end
class C; include M; end;
trac...