Ruby 2.3.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > TracePointクラス > event

instance method TracePoint#event

event -> Symbol[permalink][rdoc]

発生したイベントの種類を Symbol で返します。

発生するイベントの詳細については、TracePoint.new を参照してください。

[EXCEPTION] RuntimeError:
イベントフックの外側で実行した場合に発生します。


def foo(ret)
  ret
end
trace = TracePoint.new(:call, :return) do |tp|
  p tp.event
end
trace.enable
foo 1
# => :call
# :return