@@ -612,19 +612,24 @@ end
612
612
#
613
613
# This type of objects can be created by Enumerable#chain and Enumerator#+.
614
614
#
615
- class Enumerator::Chain [out Elem] < Enumerator[Elem, void ]
616
- include Enumerable [Elem]
615
+ class Enumerator::Chain [out Elem] < Enumerator[Elem, void ] # Rubocop: `self` type is not allowed in this context
616
+ # {Enumerator::Chain#each} without block doesn't return `self`, unlike {Enumerator#each}
617
+ include Enumerator::_Each [Enum, self ]
617
618
618
619
# <!--
619
620
# rdoc-file=enumerator.c
620
- # - obj.each(*args) { |...| ... } -> obj
621
- # - obj.each(*args) -> enumerator
621
+ # - Enumerator::Chain.new(*enums) -> enum
622
622
# -->
623
- # Iterates over the elements of the first enumerable by calling the "each"
624
- # method on it with the given arguments, then proceeds to the following
625
- # enumerables in sequence until all of the enumerables are exhausted.
623
+ # Generates a new enumerator object that iterates over the elements of given
624
+ # enumerable objects in sequence.
626
625
#
627
- # If no block is given, returns an enumerator.
626
+ # e = Enumerator::Chain.new(1..3, [4, 5])
627
+ # e.to_a #=> [1, 2, 3, 4, 5]
628
+ # e.size #=> 5
628
629
#
629
- def each : () { (Elem) -> void } -> void
630
+ def initialize : (*_Each[Elem] enums) -> void
631
+
632
+ # wrong argument type chain (expected enumerator) (TypeError)
633
+ def with_index : (?Integer) ?{ (?) -> untyped } -> bot
634
+ def each_with_index : () ?{ (?) -> untyped } -> bot
630
635
end
0 commit comments