Created
February 18, 2016 07:57
-
-
Save theHamdiz/b61ae70fb51e518e874a to your computer and use it in GitHub Desktop.
Advanced #ruby method signatures with the double star operator.
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
| # 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