/*
 *  call-seq:
 *     append_features(mod)   => mod
 *  
 *  When this module is included in another, Ruby calls
 *  <code>append_features</code> in this module, passing it the
 *  receiving module in _mod_. Ruby's default implementation is
 *  to add the constants, methods, and module variables of this module
 *  to _mod_ if this module has not already been added to
 *  _mod_ or one of its ancestors. See also <code>Module#include</code>.
 */

static VALUE
rb_mod_append_features(VALUE module, VALUE dest)
{
    switch (TYPE(dest)) {
      case T_CLASS:
      case T_MODULE:
        break;
      default:
        Check_Type(dest, T_CLASS);
        break;
    }
    rb_include_module(dest, module);

    return module;
}