class ObjectSpace::InternalObjectWrapper
ObjectSpace::InternalObjectWrapper wraps objects that are internal to the CRuby implementation and usually not directly visible in Ruby code.
ObjectSpace.reachable_objects_from and ObjectSpace.reachable_objects_from_root return instances of this class when a reachable object is an internal object. Some other ObjectSpace methods, such as ObjectSpace.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.
Public Instance Methods
Source
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));
}
See Object#inspect.
Source
static VALUE
iow_internal_object_id(VALUE self)
{
VALUE obj = (VALUE)DATA_PTR(self);
return rb_obj_id(obj);
}
Returns the Object#object_id of the wrapped internal object.
This value identifies the wrapped internal object, not the ObjectSpace::InternalObjectWrapper instance. Use it only for debugging and introspection; object ids of internal objects are implementation specific.
Source
static VALUE
iow_type(VALUE self)
{
VALUE obj = (VALUE)DATA_PTR(self);
return type2sym(BUILTIN_TYPE(obj));
}
Returns the type of the wrapped internal object as a symbol.
For example, an included module is represented internally as a T_ICLASS object:
require 'objspace' module M; end class A; include M; end iclass = ObjectSpace.internal_super_of(A) iclass.type # => :T_ICLASS
The exact set of returned symbols is implementation specific.