summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-20 12:18:07 -0700
committerJeremy Evans <code@jeremyevans.net>2019-09-20 12:18:07 -0700
commit27144de2bd95c5886c3d4400c3b8aea932b856f1 (patch)
treeb6d142bf2adf362d9f7f8da73e1b0263cd718094
parent7aeacb213bdf40bab4393448023930eac35d127a (diff)
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]
-rw-r--r--hash.c4
-rw-r--r--spec/ruby/core/env/shared/each.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index e9d994bf70..8b84a14484 100644
--- a/hash.c
+++ b/hash.c
@@ -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+.
diff --git a/spec/ruby/core/env/shared/each.rb b/spec/ruby/core/env/shared/each.rb
index 8a262e4862..261ad3a2a6 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
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