* ext/objspace/objspace.c (Init_objspace): add a new method
`ObjectSpace::InternalObjectWrapper#internal_object_id' which returns an object id of a wrapped internal object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6c6dece7f1
commit
6cbd18d7ef
@ -1,3 +1,9 @@
|
|||||||
|
Wed Oct 24 10:17:45 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* ext/objspace/objspace.c (Init_objspace): add a new method
|
||||||
|
`ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
|
||||||
|
an object id of a wrapped internal object.
|
||||||
|
|
||||||
Wed Oct 24 08:55:04 2012 Koichi Sasada <ko1@atdot.net>
|
Wed Oct 24 08:55:04 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
|
* ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
|
||||||
|
@ -668,6 +668,13 @@ iow_inspect(VALUE self)
|
|||||||
return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
|
return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
iow_internal_object_id(VALUE self)
|
||||||
|
{
|
||||||
|
VALUE obj = (VALUE)DATA_PTR(self);
|
||||||
|
return rb_obj_id(obj);
|
||||||
|
}
|
||||||
|
|
||||||
struct rof_data {
|
struct rof_data {
|
||||||
st_table *refs;
|
st_table *refs;
|
||||||
VALUE internals;
|
VALUE internals;
|
||||||
@ -787,4 +794,5 @@ Init_objspace(void)
|
|||||||
rb_mInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
|
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, "type", iow_type, 0);
|
||||||
rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);
|
rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);
|
||||||
|
rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user