Sha256: fa8b086ed89d2378dd340285a06dc8b154d40a91716a74925a6074b31c6df09d
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
#include <ruby.h> #ifdef HAVE_RUBY_BACKWARD_CLASSEXT_H #include <ruby/backward/classext.h> #endif #ifndef RCLASS_M_TBL #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) #endif static void uninclude(VALUE klass, VALUE mod) { Check_Type(mod, T_MODULE); VALUE superklass = RCLASS_SUPER(klass); VALUE lastklass = 0; for(; superklass; klass = superklass, klass = RCLASS_SUPER(klass)) { if(lastklass == klass) break; if(klass == mod || RCLASS_M_TBL(superklass) == RCLASS_M_TBL(mod)) { RCLASS_SUPER(klass) = RCLASS_SUPER(superklass); rb_clear_cache_by_class(klass); break; } lastklass = klass; }; }; static VALUE rb_m_uninclude(VALUE self, VALUE mod) { uninclude(self, mod); return self; } static VALUE rb_m_unextend(VALUE self, VALUE mod) { uninclude(rb_singleton_class(self), mod); return self; } void Init_uninclude(void) { rb_define_private_method(rb_cModule, "uninclude", RUBY_METHOD_FUNC(rb_m_uninclude), 1); rb_define_method(rb_cObject, "unextend", RUBY_METHOD_FUNC(rb_m_unextend), 1); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uninclude-1.0.1 | ext/uninclude/uninclude.c |