[DOC] Tweaks for rb_hash_s_create

This commit is contained in:
BurdetteLamar 2025-01-24 12:13:43 -06:00 committed by Peter Zhu
parent d4a1a2780c
commit b346b49744
Notes: git 2025-01-26 21:55:14 +00:00

10
hash.c
View File

@ -1791,7 +1791,7 @@ static VALUE rb_hash_to_a(VALUE hash);
/* /*
* call-seq: * call-seq:
* Hash[] -> new_empty_hash * Hash[] -> new_empty_hash
* Hash[hash] -> new_hash * Hash[other_hash] -> new_hash
* Hash[ [*2_element_arrays] ] -> new_hash * Hash[ [*2_element_arrays] ] -> new_hash
* Hash[*objects] -> new_hash * Hash[*objects] -> new_hash
* *
@ -1800,20 +1800,20 @@ static VALUE rb_hash_to_a(VALUE hash);
* *
* With no argument given, returns a new empty hash. * With no argument given, returns a new empty hash.
* *
* With a single argument given that is a hash, * With a single argument +other_hash+ given that is a hash,
* returns a new hash initialized with the entries from +hash+ * returns a new hash initialized with the entries from that hash
* (but not with its +default+ or +default_proc+): * (but not with its +default+ or +default_proc+):
* *
* h = {foo: 0, bar: 1, baz: 2} * h = {foo: 0, bar: 1, baz: 2}
* Hash[h] # => {foo: 0, bar: 1, baz: 2} * Hash[h] # => {foo: 0, bar: 1, baz: 2}
* *
* With a single argument given that is an array of 2-element arrays, * With a single argument +2_element_arrays+ given that is an array of 2-element arrays,
* returns a new hash wherein each given 2-element array forms a * returns a new hash wherein each given 2-element array forms a
* key-value entry: * key-value entry:
* *
* Hash[ [ [:foo, 0], [:bar, 1] ] ] # => {foo: 0, bar: 1} * Hash[ [ [:foo, 0], [:bar, 1] ] ] # => {foo: 0, bar: 1}
* *
* With an even number of arguments given, * With an even number of arguments +objects+ given,
* returns a new hash wherein each successive pair of arguments * returns a new hash wherein each successive pair of arguments
* is a key-value entry: * is a key-value entry:
* *