<=>(p1)
public
Comparison—Returns -1 if mod includes other_mod, 0 if
mod is the same as other_mod, and +1 if mod is
included by other_mod. Returns
nil if mod has no relationship with other_mod or if
other_mod is not a module.
Show source
static VALUE
rb_mod_cmp(VALUE mod, VALUE arg)
{
VALUE cmp;
if (mod == arg) return INT2FIX(0);
switch (TYPE(arg)) {
case T_MODULE:
case T_CLASS:
break;
default:
return Qnil;
}
cmp = rb_class_inherited_p(mod, arg);
if (NIL_P(cmp)) return Qnil;
if (cmp) {
return INT2FIX(-1);
}
return INT2FIX(1);
}