Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Enumerable#chain

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.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1