summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2025-03-11 17:07:40 -0500
committerPeter Zhu <peter@peterzhu.ca>2025-03-11 21:52:38 -0400
commit5208d2f440ec3175dc48ba5672413bb3b5cb4fd7 (patch)
tree158e42d0a25f7c3295e1d0db30dec1e74f235a2e
parent19a1370b345a6f9cbc7b9b0506eee683c0bb2cf2 (diff)
[DOC] Tweaks for Hash#shift
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12906
-rw-r--r--hash.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/hash.c b/hash.c
index 1e7ac2c7bd..fc56ad86f9 100644
--- a/hash.c
+++ b/hash.c
@@ -2480,14 +2480,16 @@ shift_i_safe(VALUE key, VALUE value, VALUE arg)
* call-seq:
* shift -> [key, value] or nil
*
- * Removes the first hash entry
- * (see {Entry Order}[rdoc-ref:Hash@Entry+Order]);
- * returns a 2-element Array containing the removed key and value:
+ * Removes and returns the first entry of +self+ as a 2-element array;
+ * see {Entry Order}[rdoc-ref:Hash@Entry+Order]:
+ *
* h = {foo: 0, bar: 1, baz: 2}
* h.shift # => [:foo, 0]
- * h # => {bar: 1, baz: 2}
+ * h # => {bar: 1, baz: 2}
+ *
+ * Returns +nil+ if +self+ is empty.
*
- * Returns nil if the hash is empty.
+ * Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting].
*/
static VALUE