Replace hash with a constant : replace « Hash « Ruby






Replace hash with a constant


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

 

Related examples in the same category

1.Replace a hash with another key-value pair
2.Replace all of the pairs in h with those from another hash