Skip to content

Instantly share code, notes, and snippets.

@theHamdiz
Created February 18, 2016 07:57
Show Gist options
  • Select an option

  • Save theHamdiz/b61ae70fb51e518e874a to your computer and use it in GitHub Desktop.

Select an option

Save theHamdiz/b61ae70fb51e518e874a to your computer and use it in GitHub Desktop.
Advanced #ruby method signatures with the double star operator.
# a is a regular parameter, the only first parameter
# *b is whatever comes after 'a' grouped in an array
# **c is any named: :argument
def my_method(a, *b, **c)
p a, b, c
end
my_method(3, 5, 7, 9, atom: 'is a text editor', ruby: 'is awesome')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment