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

ruby-changes:29331

From: zzak <ko1@a...>
Date: Tue, 18 Jun 2013 20:56:16 +0900 (JST)
Subject: [ruby-changes:29331] zzak:r41383 (trunk): * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.

zzak	2013-06-18 20:56:03 +0900 (Tue, 18 Jun 2013)

  New Revision: 41383

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

  Log:
    * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.

  Modified files:
    trunk/ChangeLog
    trunk/ext/objspace/objspace.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41382)
+++ ChangeLog	(revision 41383)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 18 20:55:05 2013  Zachary Scott  <zachary@z...>
+
+	* ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
+
 Tue Jun 18 20:39:04 2013  Zachary Scott  <zachary@z...>
 
 	* ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]
Index: ext/objspace/objspace.c
===================================================================
--- ext/objspace/objspace.c	(revision 41382)
+++ ext/objspace/objspace.c	(revision 41383)
@@ -650,6 +650,7 @@ iow_newobj(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L650
     return rb_data_typed_object_alloc(rb_mInternalObjectWrapper, (void *)obj, &iow_data_type);
 }
 
+/* Returns the type of the internal object. */
 static VALUE
 iow_type(VALUE self)
 {
@@ -657,6 +658,7 @@ iow_type(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L658
     return type2sym(BUILTIN_TYPE(obj));
 }
 
+/* See Object#inspect. */
 static VALUE
 iow_inspect(VALUE self)
 {
@@ -666,6 +668,7 @@ iow_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L668
     return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
 }
 
+/* Returns the Object#object_id of the internal object. */
 static VALUE
 iow_internal_object_id(VALUE self)
 {
@@ -805,6 +808,15 @@ Init_objspace(void) https://github.com/ruby/ruby/blob/trunk/ext/objspace/objspace.c#L808
 
     rb_define_module_function(rb_mObjSpace, "reachable_objects_from", reachable_objects_from, 1);
 
+    /*
+     * This class is used as a return value from
+     * ObjectSpace::reachable_objects_from.
+     *
+     * When ObjectSpace::reachable_objects_from returns an object with
+     * references to an internal object, an instance of this class is returned.
+     *
+     * You can use the #type method to check the type of the internal object.
+     */
     rb_mInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
     rb_define_method(rb_mInternalObjectWrapper, "type", iow_type, 0);
     rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);

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

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