summaryrefslogtreecommitdiff
path: root/ext/objspace
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-24 01:21:13 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-24 01:21:13 +0000
commit6cbd18d7ef28ab2eebc07dfb1badc9c02fba8a15 (patch)
tree435abec124a7eca13ad4b1438ea288d8ba3f8a74 /ext/objspace
parent6c6dece7f192664986c3973ed15c994cc6af1696 (diff)
* 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
Diffstat (limited to 'ext/objspace')
-rw-r--r--ext/objspace/objspace.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 6e2da9a..1fbf148 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -668,6 +668,13 @@ iow_inspect(VALUE self)
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 {
st_table *refs;
VALUE internals;
@@ -787,4 +794,5 @@ Init_objspace(void)
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);
+ rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
}