drop_while()
public
Drops elements up to, but not including, the first element for which the block returns
nil or false and returns an array containing the remaining elements.
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 }
Show source
/*
* call-seq:
* enum.drop_while {|arr| block } => array
*
* Drops elements up to, but not including, the first element for
* which the block returns nil or false and returns an array
* containing the remaining elements.
*
* a = [1, 2, 3, 4, 5, 0]
* a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
*
*/
static VALUE
enum_drop_while(obj)
VALUE obj;
{
VALUE args[2];
RETURN_ENUMERATOR(obj, 0, 0);
args[0] = rb_ary_new();
args[1] = Qfalse;
rb_block_call(obj, id_each, 0, 0, drop_while_i, (VALUE)args);
return args[0];
}