123456789_123456789_123456789_123456789_123456789_

Class: ObjectSpace::InternalObjectWrapper

Relationships & Source Files
Inherits: Object
Defined in: ext/objspace/objspace.c

Overview

InternalObjectWrapper wraps objects that are internal to the CRuby implementation and usually not directly visible in Ruby code.

reachable_objects_from and reachable_objects_from_root return instances of this class when a reachable object is an internal object. Some other ::ObjectSpace methods, such as internal_super_of, may also return wrapped internal objects.

An InternalObjectWrapper is a debugging and introspection object. Do not use it in application code. The wrapped object and the exact details of this class are implementation specific and may change in future versions.

Instance Method Summary

Instance Method Details

#inspect

See Object#inspect.

[ GitHub ]

  
# File 'ext/objspace/objspace.c', line 522

static VALUE
iow_inspect(VALUE self)
{
    VALUE obj = (VALUE)DATA_PTR(self);
    VALUE type = type2sym(BUILTIN_TYPE(obj));

    return rb_sprintf("#<InternalObject:%p %"PRIsVALUE">", (void *)obj, rb_sym2str(type));
}

#internal_object_id

Returns the Object#object_id of the internal object.

[ GitHub ]

  
# File 'ext/objspace/objspace.c', line 532

static VALUE
iow_internal_object_id(VALUE self)
{
    VALUE obj = (VALUE)DATA_PTR(self);
    return rb_obj_id(obj);
}

#type

Returns the type of the internal object.

[ GitHub ]

  
# File 'ext/objspace/objspace.c', line 514

static VALUE
iow_type(VALUE self)
{
    VALUE obj = (VALUE)DATA_PTR(self);
    return type2sym(BUILTIN_TYPE(obj));
}