Issue #7739 has been updated by alexeymuranov (Alexey Muranov).


=begin
 nathan.f77 (Nathan Broadbent) wrote:
 > I would personally love a more concise way to merge/reverse_merge hashes. Would you also propose Hash#& as merge? 
 
(({Hash#&})) would be the intersection of two hashes, i think:

  { :a => 1, :b => 2 } & { :b => 1, :c => 2 }  # => { :b => 1 }

 >  P.S. in your example, a reverse_merge should result in :b => 2 

You are right, sorry about the confusion, it should be

  { :a => 1, :b => 2 } | { :b => 1, :c => 2 }  # => { :a => 1, :b => 2, :c => 2 }
=end

----------------------------------------
Feature #7739: Define Hash#| as Hash#reverse_merge in Rails
https://bugs.ruby-lang.org/issues/7739#change-35631

Author: alexeymuranov (Alexey Muranov)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


=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/