ruby-changes:70881
From: manga_osyo <ko1@a...>
Date: Sat, 15 Jan 2022 09:09:24 +0900 (JST)
Subject: [ruby-changes:70881] 8d378fd28b (master): Add Enumerable::Lazy#with_index to NEWS-2.7.0
https://git.ruby-lang.org/ruby.git/commit/?id=8d378fd28b From 8d378fd28bcce28013499454877678cbbfe7cdc9 Mon Sep 17 00:00:00 2001 From: manga_osyo <manga.osyo@g...> Date: Thu, 25 Feb 2021 17:20:50 +0900 Subject: Add Enumerable::Lazy#with_index to NEWS-2.7.0 The behavior of `Enumerable::Lazy#with_index` has changed in Ruby 2.7. This change was not listed in the Ruby 2.7 news, so I added it. --- doc/NEWS-2.7.0 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/NEWS-2.7.0 b/doc/NEWS-2.7.0 index 184b47fb8b7..7607a473de7 100644 --- a/doc/NEWS-2.7.0 +++ b/doc/NEWS-2.7.0 @@ -357,6 +357,16 @@ See also Warning in {Core classes updates}[#label-Core+classes+updates+-28outsta https://github.com/ruby/ruby/blob/trunk/doc/NEWS-2.7.0#L357 can be directly passed to another method as a block argument. [Feature #15618] + * Added Enumerator::Lazy#with_index be lazy + Previously, Enumerator::Lazy#with_index was not defined, so it + picked up the default implementation from Enumerator, which was + not lazy. [Bug #7877] + + ("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force + # => 1:a + # 2:b + # 3:c + [Fiber] [New method] -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/