Created
September 16, 2014 12:24
-
-
Save iamvery/be41aa6ff78a154fc690 to your computer and use it in GitHub Desktop.
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
params = { some: :thing } | |
oops = {} | |
def kwargs(some:) | |
puts some | |
end | |
def hash(args) | |
puts args.fetch(:some) | |
end | |
kwargs(params) | |
hash(params) | |
begin | |
kwargs(oops) | |
rescue Exception => e | |
puts e | |
end | |
begin | |
hash(oops) | |
rescue Exception => e | |
puts e | |
end |
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
● master ~/Code/OSS » ruby kwargs-v-hash.rb | |
thing | |
thing | |
missing keyword: some | |
key not found: :some |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment