static int enc_check_encoding(VALUE obj) { if (SPECIAL_CONST_P(obj) || !rb_typeddata_is_kind_of(obj, &encoding_data_type)) { return -1; } return check_encoding(RDATA(obj)->data); }
VALUE rb_obj_is_fiber(VALUE obj) { if (rb_typeddata_is_kind_of(obj, &fiber_data_type)) { return Qtrue; } else { return Qfalse; } }
VALUE rb_obj_is_mutex(VALUE obj) { if (rb_typeddata_is_kind_of(obj, &mutex_data_type)) { return Qtrue; } else { return Qfalse; } }
/* * call-seq: * ObjectSpace.internal_class_of(obj) -> Class or Module * * [MRI specific feature] Return internal class of obj. * obj can be an instance of InternalObjectWrapper. * * Note that you should not use this method in your application. */ static VALUE objspace_internal_class_of(VALUE self, VALUE obj) { VALUE klass; if (rb_typeddata_is_kind_of(obj, &iow_data_type)) { obj = (VALUE)DATA_PTR(obj); } klass = CLASS_OF(obj); return wrap_klass_iow(klass); }
/* * call-seq: * ObjectSpace.internal_super_of(cls) -> Class or Module * * [MRI specific feature] Return internal super class of cls (Class or Module). * obj can be an instance of InternalObjectWrapper. * * Note that you should not use this method in your application. */ static VALUE objspace_internal_super_of(VALUE self, VALUE obj) { VALUE super; if (rb_typeddata_is_kind_of(obj, &iow_data_type)) { obj = (VALUE)DATA_PTR(obj); } switch (TYPE(obj)) { case T_MODULE: case T_CLASS: case T_ICLASS: super = RCLASS_SUPER(obj); break; default: rb_raise(rb_eArgError, "class or module is expected"); } return wrap_klass_iow(super); }
static VALUE reachable_objects_from(VALUE self, VALUE obj) { if (rb_objspace_markable_object_p(obj)) { VALUE ret = rb_ary_new(); struct rof_data data; if (rb_typeddata_is_kind_of(obj, &iow_data_type)) { obj = (VALUE)DATA_PTR(obj); } data.refs = st_init_numtable(); data.internals = rb_ary_new(); rb_objspace_reachable_objects_from(obj, reachable_object_from_i, &data); st_foreach(data.refs, collect_values, (st_data_t)ret); return ret; } else { return Qnil; } }
int rb_backtrace_p(VALUE obj) { return rb_typeddata_is_kind_of(obj, &backtrace_data_type); }