Mega Code Archive

 
Categories / Ruby / Hash
 

Replace all of the pairs in h with those from another hash

h = {}        # Start with an empty hash h[:a] = 1     # Map :a=>1.  h is now {:a=>1} h.store(:b,2) # More verbose: h is now {:a=>1, :b=>2} h.replace({1=>:a, 2=>;b}  # h is now equal to the argument hash