[DOC] Fix indent of set_trace_func document

This commit is contained in:
Nobuyoshi Nakada 2023-09-04 09:23:31 +09:00
parent 7e0f5df2f9
commit 3b7c8e90da
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2023-09-04 01:42:16 +00:00

View File

@ -510,62 +510,64 @@ static void call_trace_func(rb_event_flag_t, VALUE data, VALUE self, ID id, VALU
/* (2-1) set_trace_func (old API) */ /* (2-1) set_trace_func (old API) */
/* /*
* call-seq: * call-seq:
* set_trace_func(proc) -> proc * set_trace_func(proc) -> proc
* set_trace_func(nil) -> nil * set_trace_func(nil) -> nil
* *
* Establishes _proc_ as the handler for tracing, or disables * Establishes _proc_ as the handler for tracing, or disables
* tracing if the parameter is +nil+. * tracing if the parameter is +nil+.
* *
* *Note:* this method is obsolete, please use TracePoint instead. * *Note:* this method is obsolete, please use TracePoint instead.
* *
* _proc_ takes up to six parameters: * _proc_ takes up to six parameters:
* *
* * an event name * * an event name
* * a filename * * a filename
* * a line number * * a line number
* * an object id * * an object id
* * a binding * * a binding
* * the name of a class * * the name of a class
* *
* _proc_ is invoked whenever an event occurs. * _proc_ is invoked whenever an event occurs.
* *
* Events are: * Events are:
* *
* +c-call+:: call a C-language routine * +c-call+:: call a C-language routine
* +c-return+:: return from a C-language routine * +c-return+:: return from a C-language routine
* +call+:: call a Ruby method * +call+:: call a Ruby method
* +class+:: start a class or module definition * +class+:: start a class or module definition
* +end+:: finish a class or module definition * +end+:: finish a class or module definition
* +line+:: execute code on a new line * +line+:: execute code on a new line
* +raise+:: raise an exception * +raise+:: raise an exception
* +return+:: return from a Ruby method * +return+:: return from a Ruby method
* *
* Tracing is disabled within the context of _proc_. * Tracing is disabled within the context of _proc_.
* *
* class Test * class Test
* def test * def test
* a = 1 * a = 1
* b = 2 * b = 2
* end * end
* end * end
* *
* set_trace_func proc { |event, file, line, id, binding, classname| * set_trace_func proc { |event, file, line, id, binding, classname|
* printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname * printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
* } * }
* t = Test.new * t = Test.new
* t.test * t.test
* *
* line prog.rb:11 false * Produces:
* c-call prog.rb:11 new Class *
* c-call prog.rb:11 initialize Object * line prog.rb:11 false
* c-return prog.rb:11 initialize Object * c-call prog.rb:11 new Class
* c-return prog.rb:11 new Class * c-call prog.rb:11 initialize Object
* line prog.rb:12 false * c-return prog.rb:11 initialize Object
* call prog.rb:2 test Test * c-return prog.rb:11 new Class
* line prog.rb:3 test Test * line prog.rb:12 false
* line prog.rb:4 test Test * call prog.rb:2 test Test
* return prog.rb:4 test Test * line prog.rb:3 test Test
* line prog.rb:4 test Test
* return prog.rb:4 test Test
* *
* Note that for +c-call+ and +c-return+ events, the binding returned is the * Note that for +c-call+ and +c-return+ events, the binding returned is the
* binding of the nearest Ruby method calling the C method, since C methods * binding of the nearest Ruby method calling the C method, since C methods