Created
February 7, 2014 06:34
-
-
Save yaotti/8858244 to your computer and use it in GitHub Desktop.
Ruby's named params and a hash with string keys
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
def foo(arg: 1) | |
puts "arg: #{arg}" | |
end | |
foo({ arg: 10 }) | |
#=> arg: 10 | |
foo({ 'arg' => 10 }) | |
#=> /Users/yaotti/sandbox/named-params.rb:1:in `foo': wrong number of arguments (1 for 0) (ArgumentError) | |
# from /Users/yaotti/sandbox/named-params.rb:6:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment