instance method Enumerator::Lazy#grep

grep(pattern) {|item| ... } -> Enumerator::Lazy[permalink][rdoc]

Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。

例:

(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]

[SEE_ALSO] Enumerable#grep, Enumerable#grep_v, Enumerator::Lazy#grep_v