Skip to content

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

instance method

Enumerable#chain

[Elem2] (*::_Each[Elem2] enumerables) -> ::Enumerator::Chain[E | Elem2]
e.chain(*enums) → enumerator

Returns an enumerator object generated from this enumerator and given enumerables.

Example
e = (1..3).chain([4, 5])
e.to_a #=> [1, 2, 3, 4, 5]
See also #any? #chunk #all? #chunk_while also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0