ruby-changes:57851
From: Jeremy <ko1@a...>
Date: Sat, 21 Sep 2019 04:22:14 +0900 (JST)
Subject: [ruby-changes:57851] 27144de2bd (master): Fix documentation for ENV.each to return ENV
https://git.ruby-lang.org/ruby.git/commit/?id=27144de2bd From 27144de2bd95c5886c3d4400c3b8aea932b856f1 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Fri, 20 Sep 2019 12:18:07 -0700 Subject: Fix documentation for ENV.each to return ENV Also have spec check that it returns ENV. Mostly from burdettelamar@y... (Burdette Lamar). Fixes [Bug #16164] diff --git a/hash.c b/hash.c index e9d994b..8b84a14 100644 --- a/hash.c +++ b/hash.c @@ -5276,9 +5276,9 @@ env_each_value(VALUE ehash) https://github.com/ruby/ruby/blob/trunk/hash.c#L5276 /* * call-seq: - * ENV.each { |name, value| block } -> Hash + * ENV.each { |name, value| block } -> ENV * ENV.each -> Enumerator - * ENV.each_pair { |name, value| block } -> Hash + * ENV.each_pair { |name, value| block } -> ENV * ENV.each_pair -> Enumerator * * Yields each environment variable +name+ and +value+. diff --git a/spec/ruby/core/env/shared/each.rb b/spec/ruby/core/env/shared/each.rb index 8a262e4..261ad3a 100644 --- a/spec/ruby/core/env/shared/each.rb +++ b/spec/ruby/core/env/shared/each.rb @@ -8,7 +8,7 @@ describe :env_each, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/env/shared/each.rb#L8 ENV.clear ENV["foo"] = "bar" ENV["baz"] = "boo" - ENV.send(@method) { |k, v| e << [k, v] } + ENV.send(@method) { |k, v| e << [k, v] }.should equal(ENV) e.should include(["foo", "bar"]) e.should include(["baz", "boo"]) ensure -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/