1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix documentation for ENV.each to return ENV

Also have spec check that it returns ENV.

Mostly from burdettelamar@yahoo.com (Burdette Lamar).

Fixes [Bug #16164]
This commit is contained in:
Jeremy Evans 2019-09-20 12:18:07 -07:00
parent 7aeacb213b
commit 27144de2bd
2 changed files with 3 additions and 3 deletions

4
hash.c
View file

@ -5276,9 +5276,9 @@ env_each_value(VALUE ehash)
/*
* 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+.

View file

@ -8,7 +8,7 @@ describe :env_each, shared: true do
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