ruby-changes:25995
From: zzak <ko1@a...>
Date: Fri, 30 Nov 2012 19:29:58 +0900 (JST)
Subject: [ruby-changes:25995] zzak:r38052 (trunk): * vm_trace.c:
zzak 2012-11-30 19:29:49 +0900 (Fri, 30 Nov 2012) New Revision: 38052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38052 Log: * vm_trace.c: tracepoint_attr_return_value (TracePoint#return_value): include `:b_return` for method doc tracepoint_enable_m, tracepoint_disable_m (#enable/#disable): don't have block argument, document block scope Modified files: trunk/ChangeLog trunk/vm_trace.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38051) +++ ChangeLog (revision 38052) @@ -1,3 +1,11 @@ +Fri Nov 30 19:30:00 2012 Zachary Scott <zachary@z...> + + * vm_trace.c: + tracepoint_attr_return_value (TracePoint#return_value): + include `:b_return` for method doc + tracepoint_enable_m, tracepoint_disable_m (#enable/#disable): + don't have block argument, document block scope + Fri Nov 30 18:52:56 2012 Koichi Sasada <ko1@a...> * vm_trace.c (tracepoint_disable_m, tracepoint_enable_m): Index: vm_trace.c =================================================================== --- vm_trace.c (revision 38051) +++ vm_trace.c (revision 38052) @@ -868,7 +868,7 @@ } /* - * Return value from +:return+ and +c_return+ event + * Return value from +:return+, +c_return+, and +b_return+ event */ static VALUE tracepoint_attr_return_value(VALUE tpval) @@ -950,8 +950,8 @@ /* * call-seq: - * trace.enable -> trace - * trace.enable { |obj| block } -> obj + * trace.enable -> trace + * trace.enable { block } -> obj * * Activates the trace * @@ -962,6 +962,23 @@ * trace.enabled? #=> true * trace.enable #=> RuntimeError * + * If a block is given, the trace will only be enabled within the scope of the + * block. Note: You cannot access event hooks within the block. + * + * trace.enabled? + * #=> false + * + * trace.enable do + * trace.enabled? + * # only enabled for this block + * end + * + * trace.enabled? + * #=> false + * + * trace.enable { p tp.lineno } + * #=> RuntimeError: access from outside + * */ static VALUE tracepoint_enable_m(VALUE tpval) @@ -983,8 +1000,8 @@ /* * call-seq: - * trace.disable -> trace - * trace.disable { |obj| block } -> obj + * trace.disable -> trace + * trace.disable { block } -> obj * * Deactivates the trace * @@ -995,6 +1012,23 @@ * trace.enabled? #=> false * trace.disable #=> RuntimeError * + * If a block is given, the trace will only be disable within the scope of the + * block. Note: You cannot access event hooks within the block. + * + * trace.enabled? + * #=> true + * + * trace.disable do + * trace.enabled? + * # only disabled for this block + * end + * + * trace.enabled? + * #=> true + * + * trace.enable { p trace.lineno } + * #=> RuntimeError: access from outside + * */ static VALUE tracepoint_disable_m(VALUE tpval) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/