Created
November 19, 2015 21:12
-
-
Save piotrze/ce8fcb585c5a80655156 to your computer and use it in GitHub Desktop.
ruby named params
This file contains hidden or 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(a:, b:, c:) | |
puts "a: #{a}, b: #{b}, c: #{c}" | |
end | |
foo(a: 1, c: 3, b: 2) # a: 1, b: 2, c: 3 | |
#or with hash | |
params = {a: 1, b: 2, c: 3} | |
foo(params) # a: 1, b: 2, c: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment