End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Enumerator::Lazy#_enumerable_take
_enumerable_take(p1)
enumerator.c
View on GitHub ↗
static VALUE
lazy_take(VALUE obj, VALUE n)
{
long len = NUM2LONG(n);
if (len < 0) {
rb_raise(rb_eArgError, "attempt to take negative size");
}
n = LONG2NUM(len); /* no more conversion */
return lazy_add_method(obj, 0, 0, n, rb_ary_new3(1, n), &lazy_take_funcs);
}
Alias of #take
Like Enumerable#take, but chains operation to be lazy-evaluated.
See also
#take
#_enumerable_select
#_enumerable_take_while
#_enumerable_reject
also in
4.0 · 3.4 · 3.3 · 3.1 · 3.0