1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2013-06-18 11:56:03 +00:00
parent b46df185b2
commit a8ba051341
2 changed files with 16 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Tue Jun 18 20:55:05 2013 Zachary Scott <zachary@zacharyscott.net>
* ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
Tue Jun 18 20:39:04 2013 Zachary Scott <zachary@zacharyscott.net>
* ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]

View file

@ -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);