Skip to content

Instantly share code, notes, and snippets.

@piotrze
Created November 19, 2015 21:12
Show Gist options
  • Save piotrze/ce8fcb585c5a80655156 to your computer and use it in GitHub Desktop.
Save piotrze/ce8fcb585c5a80655156 to your computer and use it in GitHub Desktop.
ruby named params
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