Hash#update

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

https://ruby-doc.org/core-2.5.1/Hash.html#update-method

thank you,
-az

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

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

···

On Jun 12, 2018, at 00:33, Artie Ziff <artie.ziff@gmail.com> wrote:

>> h = {}
>> h.method(:merge!) == h.method(:update)
=> true

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.

···

--------------------------------------
Dmitriy Non
non.dmitriy@gmail.com

On 12 Jun 2018, at 11:46, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Jun 12, 2018, at 00:33, Artie Ziff <artie.ziff@gmail.com> wrote:

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

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

h = {}
h.method(:merge!) == h.method(:update)

=> true

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

This is quite confusing

···

2018-06-13 11:29 GMT+02:00 Dmitriy Non <non.dmitriy@gmail.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.

--------------------------------------
Dmitriy Non
non.dmitriy@gmail.com

On 12 Jun 2018, at 11:46, Ryan Davis <ryand-ruby@zenspider.com> wrote:

> On Jun 12, 2018, at 00:33, Artie Ziff <artie.ziff@gmail.com> wrote:
>
> Is there some reason that ruby-doc.org presents the merge method in the
example block for update method ?

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

>>> h = {}
>>> h.method(:merge!) == h.method(:update)
> => true

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>

How so?

···

--------------------------------------
Dmitriy Non
non.dmitriy@gmail.com

On 13 Jun 2018, at 12:43, Daniele Cantarini <daniele.cantarini@gmail.com> wrote:

This is quite confusing

2018-06-13 11:29 GMT+02:00 Dmitriy Non <non.dmitriy@gmail.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.

--------------------------------------
Dmitriy Non
non.dmitriy@gmail.com

On 12 Jun 2018, at 11:46, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Jun 12, 2018, at 00:33, Artie Ziff <artie.ziff@gmail.com> wrote:

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

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

h = {}
h.method(:merge!) == h.method(:update)

=> true

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>