public Method

Class.new(...)

class.new(args, ...)      obj

Calls allocate to create a new object of class’s class, then invokes that object’s initialize method, passing it args. This is the method that ends up getting called whenever an object is constructed using .new.

Source Code

/*
*  call-seq:
*     class.new(args, ...)    =>  obj
*  
*  Calls <code>allocate</code> to create a new object of
*  <i>class</i>'s class, then invokes that object's
*  <code>initialize</code> method, passing it <i>args</i>.
*  This is the method that ends up getting called whenever
*  an object is constructed using .new.
*     
*/

VALUE
rb_class_new_instance(argc, argv, klass)
   int argc;
   VALUE *argv;
   VALUE klass;
{
   VALUE obj;

   obj = rb_obj_alloc(klass);
   rb_obj_call_init(obj, argc, argv);

   return obj;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.