中規模のライブラリを理解しようとしています。テスト スクリプトを実行して、処理中のコマンドを確認したいと考えています。
出来ますか?
ありがとう!
Kernel#set_trace_funcを使用して、すべてのcall
イベントをトレースできます。
class Foo
def bar
end
end
set_trace_func proc { |event, file, line, id, binding, classname|
if event == "call"
printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
end
}
Foo.new.bar
# => call foo.rb:2 bar Foo