new(...)
public
Creates a new anonymous (unnamed) class with
the given superclass (or Object if no parameter is given). You can give
a class a name by assigning the class object to a constant.
Show source
/*
* call-seq:
* Class.new(super_class=Object) => a_class
*
* Creates a new anonymous (unnamed) class with the given superclass
* (or <code>Object</code> if no parameter is given). You can give a
* class a name by assigning the class object to a constant.
*
*/
static VALUE
rb_class_initialize(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE super;
if (RCLASS(klass)->super != 0) {
rb_raise(rb_eTypeError, "already initialized class");
}
if (rb_scan_args(argc, argv, "01", &super) == 0) {
super = rb_cObject;
}
else {
rb_check_inheritable(super);
}
RCLASS(klass)->super = super;
rb_make_metaclass(klass, RBASIC(super)->klass);
rb_mod_initialize(klass);
rb_class_inherited(super, klass);
return klass;
}