mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[DOC] Mention that Hash#replace also replaces defaults
This commit is contained in:
parent
e2fbd01714
commit
cbe5241c77
1 changed files with 8 additions and 0 deletions
8
hash.c
8
hash.c
|
@ -2987,6 +2987,14 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
|
||||||
* h = {foo: 0, bar: 1, baz: 2}
|
* h = {foo: 0, bar: 1, baz: 2}
|
||||||
* h.replace({bat: 3, bam: 4}) # => {bat: 3, bam: 4}
|
* h.replace({bat: 3, bam: 4}) # => {bat: 3, bam: 4}
|
||||||
*
|
*
|
||||||
|
* Also replaces the default value or proc of +self+ with the default value
|
||||||
|
* or proc of +other_hash+.
|
||||||
|
*
|
||||||
|
* h = {}
|
||||||
|
* other = Hash.new(:ok)
|
||||||
|
* h.replace(other)
|
||||||
|
* h.default # => :ok
|
||||||
|
*
|
||||||
* Related: see {Methods for Assigning}[rdoc-ref:Hash@Methods+for+Assigning].
|
* Related: see {Methods for Assigning}[rdoc-ref:Hash@Methods+for+Assigning].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue