class Enumerator::Chain
Enumerator::Chain is a subclass of Enumerator, which represents a chain of enumerables that works as a single enumerator.
This type of objects can be created by Enumerable#chain and Enumerator#+.
Public Class Methods
(*_Each[Elem] enums) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/enumerator.rbs, line 690
def initialize: (*_Each[Elem] enums) -> void
Generates a new enumerator object that iterates over the elements of given enumerable objects in sequence.
e = Enumerator::Chain.new(1..3, [4, 5]) e.to_a #=> [1, 2, 3, 4, 5] e.size #=> 5
Public Instance Methods
() { (Elem) → void } → self
() → Enumerator[Elem, self]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/core/enumerator.rbs, line 703
def each: () { (Elem) -> void } -> self
| () -> Enumerator[Elem, self]
Iterates over the elements of the first enumerable by calling the βeachβ method on it with the given arguments, then proceeds to the following enumerables in sequence until all of the enumerables are exhausted.
If no block is given, returns an enumerator.