Class: Module

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#unmixer_unmixin(mod) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'ext/unmixer/unmixer.c', line 29

static VALUE rb_m_unmixin(VALUE self, VALUE mod) {
  Check_Type(mod, T_MODULE);

//   printf("self:%x\n", self);
//   printf("mod:%x\n", mod);
  VALUE superklass = RCLASS_SUPER(self);
  VALUE lastklass = self;

  do {
//     printf("------------------------------\n");
//     printf("class:%s\n", rb_obj_classname(superklass));
//     printf("class:%s\n", rb_class2name(superklass));
    if(RB_TYPE_P(superklass, RUBY_T_CLASS) && superklass != self) break;
    if(superklass == mod || RCLASS_M_TBL(superklass) == RCLASS_M_TBL(mod)) {
      RCLASS_SUPER(lastklass) = RCLASS_SUPER(superklass);
      RB_CLEAR_CACHE_BY_CLASS(lastklass);
      break;
    }
	lastklass = superklass;
    superklass = RCLASS_SUPER(superklass);
  } while (superklass);

  return self;
}