From: Nathan Broadbent Date: 2013-01-25T03:31:28+09:00 Subject: [ruby-core:51625] Re: [ruby-trunk - Feature #7739][Open] Define Hash#| as Hash#reverse_merge in Rails --510176dd_66ef438d_1311 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline I would personally love a more concise way to merge/reverse_merge hashes. Would you also propose Hash#& as merge? P.S. in your example, a reverse_merge should result in :b => 2 On Friday, 25 January 2013 at 1:57 AM, alexeymuranov (Alexey Muranov) wrote: > > Issue #7739 has been reported by alexeymuranov (Alexey Muranov). > > ---------------------------------------- > Feature #7739: Define Hash#| as Hash#reverse_merge in Rails > https://bugs.ruby-lang.org/issues/7739 > > Author: alexeymuranov (Alexey Muranov) > Status: Open > Priority: Normal > Assignee: > Category: core > Target version: > > > =begin > I suggest for to define (({Hash#|})) as (({Hash#reverse_merge})) in ((*Rails*)), in my opinion this would correspond nicely to (({Set#|})), to the logical (({#||})) and to the bitwise (({#|})): > > { :a => 1, :b => 2 } | { :b => 1, :c => 2 } # => { :a => 1, :b => 1, :c => 2 } > =end > > > > -- > http://bugs.ruby-lang.org/ > > --510176dd_66ef438d_1311 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I would personally love a more concise = way to merge/reverse=5Fmerge hashes. Would you also propose Hash=23& = as merge=3F

P.S. in your example, a reverse=5Fmerge should result in :b =3D>= ; 2
=20

On =46riday, 25 January 2013 at 1:= 57 AM, alexeymuranov (Alexey Muranov) wrote:


I= ssue =237739 has been reported by alexeymuranov (Alexey Muranov).

----------------------------------------
=46e= ature =237739: Define Hash=23=7C as Hash=23reverse=5Fmerge in Rails
=
https://bugs.ruby-lang.org/issues/7739

Auth= or: alexeymuranov (Alexey Muranov)
Status: Open
Prior= ity: Normal
Assignee:
Category: core
Targe= t version:


=3Dbegin
I = suggest for to define ((=7BHash=23=7C=7D)) as ((=7BHash=23reverse=5Fmerge= =7D)) in ((*Rails*)), in my opinion this would correspond nicely to ((=7B= Set=23=7C=7D)), to the logical ((=7B=23=7C=7C=7D)) and to the bitwise ((=7B= =23=7C=7D)):

=7B :a =3D> 1, :b =3D> 2 =7D= =7C =7B :b =3D> 1, :c =3D> 2 =7D =23 =3D> =7B :a =3D> 1, :b= =3D> 1, :c =3D> 2 =7D
=3Dend


--
http://bugs.ruby-lang.org/
=20 =20 =20 =20
=20

--510176dd_66ef438d_1311--