End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Enumerator::Lazy#grep
lazy.grep(pattern) → lazy_enumerator
lazy.grep(pattern) { |obj| block } → lazy_enumerator
enumerator.c
View on GitHub ↗
static VALUE
lazy_grep(VALUE obj, VALUE pattern)
{
const lazyenum_funcs *const funcs = rb_block_given_p() ?
&lazy_grep_iter_funcs : &lazy_grep_funcs;
return lazy_add_method(obj, 0, 0, pattern, rb_ary_new3(1, pattern), funcs);
}
Like Enumerable#grep, but chains operation to be lazy-evaluated.