summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2025-02-18 09:10:29 -0600
committerPeter Zhu <peter@peterzhu.ca>2025-02-18 15:02:05 -0500
commitfd134cf6d2af656f94a6bb1a2a251f66b5ad1bf8 (patch)
tree9000a381972fe67e59d4cddb516787b93dcf6fc8
parenteafcdc153560fd391dabd60705cb88e3f72d7b47 (diff)
[DOC] Tweaks for Hash#each_value
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12774
-rw-r--r--hash.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/hash.c b/hash.c
index 8fe94c03aa..3c143141be 100644
--- a/hash.c
+++ b/hash.c
@@ -3039,23 +3039,19 @@ each_value_i(VALUE key, VALUE value, VALUE _)
* each_value {|value| ... } -> self
* each_value -> new_enumerator
*
- * Calls the given block with each value; returns +self+:
+ * With a block given, calls the block with each value; returns +self+:
+ *
* h = {foo: 0, bar: 1, baz: 2}
* h.each_value {|value| puts value } # => {foo: 0, bar: 1, baz: 2}
- * Output:
- * 0
- * 1
- * 2
*
- * Returns a new Enumerator if no block given:
- * h = {foo: 0, bar: 1, baz: 2}
- * e = h.each_value # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:each_value>
- * h1 = e.each {|value| puts value }
- * h1 # => {foo: 0, bar: 1, baz: 2}
* Output:
* 0
* 1
* 2
+ *
+ * With no block given, returns a new Enumerator.
+ *
+ * Related: see {Methods for Iterating}[rdoc-ref:Hash@Methods+for+Iterating].
*/
static VALUE