Your IP : 3.142.36.215
--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: "Establishes <em>proc</em> as the handler for tracing, or disables tracing if the parameter is <tt>nil</tt>. <em>proc</em> takes up to six parameters: an event name, a filename, a line number, an object id, a binding, and the name of a class. <em>proc</em> is invoked whenever an event occurs. Events are: <tt>c-call</tt> (call a C-language routine), <tt>c-return</tt> (return from a C-language routine), <tt>call</tt> (call a Ruby method), <tt>class</tt> (start a class or module definition), <tt>end</tt> (finish a class or module definition), <tt>line</tt> (execute code on a new line), <tt>raise</tt> (raise an exception), and <tt>return</tt> (return from a Ruby method). Tracing is disabled within the context of <em>proc</em>."
- !ruby/struct:SM::Flow::VERB
body: " class Test\n def test\n a = 1\n b = 2\n end\n end\n\n set_trace_func proc { |event, file, line, id, binding, classname|\n printf "%8s %s:%-2d %10s %8s\\n", event, file, line, id, classname\n }\n t = Test.new\n t.test\n\n line prog.rb:11 false\n c-call prog.rb:11 new Class\n c-call prog.rb:11 initialize Object\n c-return prog.rb:11 initialize Object\n c-return prog.rb:11 new Class\n line prog.rb:12 false\n call prog.rb:2 test Test\n line prog.rb:3 test Test\n line prog.rb:4 test Test\n return prog.rb:4 test Test\n"
full_name: Kernel#set_trace_func
is_singleton: false
name: set_trace_func
params: |
set_trace_func(proc) => proc
set_trace_func(nil) => nil
visibility: public