Created
May 24, 2013 03:32
-
-
Save ravelll/5641122 to your computer and use it in GitHub Desktop.
ruby on rails tutorial Chapter4 exercise4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hsh1 = {first:"Satoshi",last:"Tanaka",age:"25"} | |
hsh2 = {last:"Suzuki",age:"30"} | |
#show the newest values | |
puts hsh1.merge(hsh2) | |
#show old value when the key duplicated | |
puts hsh1.merge(hsh2){|key,oldv,newv|oldv} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment