Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Enumerator#+

[Elem2] (::_Each[Elem2]) -> ::Enumerator::Chain[E | Elem2]
e + enum → enumerator

Returns an enumerator object generated from this enumerator and a given enumerable.

Example
e = (1..3).each + [4, 5]
e.to_a #=> [1, 2, 3, 4, 5]
See also .product #each .produce #each_with_index also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0