DevHeads.net

Hash#update

Is there some reason that ruby-doc.org presents the merge method in the
example block for update method ?

<a href="https://ruby-doc.org/core-2.5.1/Hash.html#update-method" title="https://ruby-doc.org/core-2.5.1/Hash.html#update-method">https://ruby-doc.org/core-2.5.1/Hash.html#update-method</a>

thank you,
-az

Comments

Re: Hash#update

By Ryan Davis at 06/12/2018 - 04:46

It doesn’t. It presents #merge!, not #merge. #update and #merge are the same:

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Re: Hash#update

By =?utf-8?B?0JTQv... at 06/13/2018 - 05:29

Hi!
You made a typo.

Of course, `#update` is just an alias for `#merge!`.
Even method names tell that. Hash updating is merging it with another hash.

It doesn’t. It presents #merge!, not #merge. #update and #merge are the same:

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Re: Hash#update

By daniele cantarini at 06/13/2018 - 05:43

This is quite confusing

2018-06-13 11:29 GMT+02:00 Dmitriy Non <non. ... at gmail dot com>:

Re: Hash#update

By =?utf-8?B?0JTQv... at 06/13/2018 - 07:56

How so?

This is quite confusing

2018-06-13 11:29 GMT+02:00 Dmitriy Non <non. ... at gmail dot com>:
Hi!
You made a typo.

Of course, `#update` is just an alias for `#merge!`.
Even method names tell that. Hash updating is merging it with another hash.

It doesn’t. It presents #merge!, not #merge. #update and #merge are the same:

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>