drop(p1)
public
Drops first n elements from
enum, and returns rest elements in an array.
a = [1, 2, 3, 4, 5, 0]
a.drop(3)
Show source
/*
* call-seq:
* enum.drop(n) => array
*
* Drops first n elements from <i>enum</i>, and returns rest elements
* in an array.
*
* a = [1, 2, 3, 4, 5, 0]
* a.drop(3)
*
*/
static VALUE
enum_drop(obj, n)
VALUE obj;
VALUE n;
{
VALUE args[2];
long len = NUM2LONG(n);
if (len < 0) {
rb_raise(rb_eArgError, "attempt to drop negative size");
}
args[1] = len;
args[0] = rb_ary_new();
rb_block_call(obj, id_each, 0, 0, drop_i, (VALUE)args);
return args[0];
}