From 0904ae6a2dd4e9de67b6ef86695b557e2789bc26 Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Fri, 28 Jun 2024 22:48:07 -0600 Subject: [PATCH] Add `Enumerator::_Each` interface Resolves #424 --- core/enumerator.rbs | 7 +++++++ docs/syntax.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/enumerator.rbs b/core/enumerator.rbs index 30b32d46f..ecd6587f2 100644 --- a/core/enumerator.rbs +++ b/core/enumerator.rbs @@ -130,6 +130,13 @@ class Enumerator[unchecked out Elem, out Return] < Object include Enumerable[Elem] + # A convenience interface for `each` with optional block + # + interface _Each[out E, out R] + def each: () { (E) -> void } -> R + | () -> Enumerator[E, R] + end + #