Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Enumerator::Lazy#drop
(::Integer n) -> ::Array[E]
lazy.drop(n) → lazy_enumerator
enumerator.c
View on GitHub ↗
static VALUE
lazy_drop(VALUE obj, VALUE n)
{
rb_len_t len = NUM2LEN(n);
VALUE argv[2];
argv[0] = sym_each;
argv[1] = n;
if (len < 0) {
rb_raise(rb_eArgError, "attempt to drop negative size");
}
return lazy_add_method(obj, 2, argv, n, rb_ary_new3(1, n), &lazy_drop_funcs);
}
Like Enumerable#drop, but chains operation to be lazy-evaluated.
See also
#compact
#drop_while
#collect_concat
#each_with_index
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0