public Method

Array.push(...)

array.push(obj, ... )    array

Append—Pushes the given object(s) on to the end of this array. This

expression returns the array itself, so several appends
may be chained together.

   a = [ "a", "b", "c" ]
   a.push("d", "e", "f")

> ["a", "b", "c", "d", "e", "f"]

Source Code

/* 
*  call-seq:
*     array.push(obj, ... )   -> array
*  
*  Append---Pushes the given object(s) on to the end of this array. This
*  expression returns the array itself, so several appends
*  may be chained together.
*
*     a = [ "a", "b", "c" ]
*     a.push("d", "e", "f")  
*             #=> ["a", "b", "c", "d", "e", "f"]
*/

static VALUE
rb_ary_push_m(argc, argv, ary)
   int argc;
   VALUE *argv;
   VALUE ary;
{
   while (argc--) {
       rb_ary_push(ary, *argv++);
   }
   return ary;
}
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.