Replace a hash with another key-value pair : replace « Hash « Ruby






Replace a hash with another key-value pair


counties = { "Three" => 3, "Five" => 5 }
temp = {"Three" => 3 }
counties.replace( temp )

 








Related examples in the same category

1.Replace hash with a constant
2.Replace all of the pairs in h with those from another hash