class ObjectSpace::InternalObjectWrapper - Documentation for Ruby 4.0
Description: class ObjectSpace::InternalObjectWrapper: reachable_objects_from. reachable_objects_from returns an object with references to an internal object, an instance of this class is returned.
Keywords: ruby,class,ObjectSpace::InternalObjectWrapper

🔍

No recent searches

# class ObjectSpace::InternalObjectWrapper

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.

### Public Instance Methods

inspect ()
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`.

internal_object_id ()
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 internal object.

type ()
Source

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

Returns the type of the internal object.