[前][次][番号順一覧][スレッド一覧]

ruby-changes:26389

From: zzak <ko1@a...>
Date: Tue, 18 Dec 2012 13:18:15 +0900 (JST)
Subject: [ruby-changes:26389] zzak:r38440 (trunk): * vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for

zzak	2012-12-18 13:18:06 +0900 (Tue, 18 Dec 2012)

  New Revision: 38440

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38440

  Log:
    * vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for
      TracePoint#defined_class

  Modified files:
    trunk/ChangeLog
    trunk/vm_trace.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38439)
+++ ChangeLog	(revision 38440)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 18 13:17:00 2012  Zachary Scott  <zachary@z...>
+
+	* vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for
+	  TracePoint#defined_class
+
 Tue Dec 18 12:15:59 2012  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems/specification.rb:  Fixed ruby output of requirements
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 38439)
+++ vm_trace.c	(revision 38440)
@@ -835,36 +835,38 @@ tracepoint_attr_method_id(VALUE tpval) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L835
 }
 
 /*
- * Return class or module the method being called.
+ * Return class or module of the method being called.
  *
- *          class C; def foo; end; end
- *	    trace = TracePoint.new(:call) do |tp|
- *            tp.defined_class #=> C
- *          end.enable do
- *            C.new.foo
- *          end
- *
- * If method is defined by a module, then returns that module.
- *
- *          module M; def foo; end; end
- *          class C; include M; end;
- *	    trace = TracePoint.new(:call) do |tp|
- *            tp.defined_class #=> M
- *          end.enable do
- *            C.new.foo
- *          end
- *
- * Note that TracePont#defined_class returns singleton class.
- * 6th block parameter of `set_trace_func' passes original class
- * of attached by singleton class. This is a difference between
- * `set_trace_func' and TracePoint.
- * 
- *          class C; def self.foo; end; end
- *	    trace = TracePoint.new(:call) do |tp|
- *            tp.defined_class #=> #<Class:C>
- *          end.enable do
- *            C.foo
- *          end
+ *	class C; def foo; end; end
+ * 	trace = TracePoint.new(:call) do |tp|
+ * 	  p tp.defined_class #=> C
+ * 	end.enable do
+ * 	  C.new.foo
+ * 	end
+ *
+ * If method is defined by a module, then that module is returned.
+ *
+ *	module M; def foo; end; end
+ * 	class C; include M; end;
+ * 	trace = TracePoint.new(:call) do |tp|
+ * 	  p tp.defined_class #=> M
+ * 	end.enable do
+ * 	  C.new.foo
+ * 	end
+ *
+ * <b>Note:</b> #defined_class returns singleton class.
+ *
+ * 6th block parameter of Kernel#set_trace_func passes original class
+ * of attached by singleton class.
+ *
+ * <b>This is a difference between Kernel#set_trace_func and TracePoint.</b>
+ *
+ *	class C; def self.foo; end; end
+ * 	trace = TracePoint.new(:call) do |tp|
+ * 	  p tp.defined_class #=> #<Class:C>
+ * 	end.enable do
+ * 	  C.foo
+ * 	end
  */
 static VALUE
 tracepoint_attr_defined_class(VALUE tpval)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]