summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-18 11:56:03 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-18 11:56:03 +0000
commita8ba051341fd479d5daef1ad46edd41570112d6e (patch)
tree37fe9da4031c4bd4c03e4d6c1f22366db2e1a552 /ext/objspace
parentb46df185b2f793713a442de4161ce5751eedd17a (diff)
* ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 6808352852..2494855cc9 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -650,6 +650,7 @@ iow_newobj(VALUE obj)
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)
return type2sym(BUILTIN_TYPE(obj));
}
+/* See Object#inspect. */
static VALUE
iow_inspect(VALUE self)
{
@@ -666,6 +668,7 @@ iow_inspect(VALUE self)
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)
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);