QuickTips Ruby1.9 [Part 3] Default and Splat arguments

Ruby 1.9 has changed the way it used to deal with default arguments. The good news is it supports defaults arguments to be at beginning of methods. See gist below for example:

You can continue to use default arguments at the end of method arguments as you were used to in 1.8.x, See example below

But do note that you can not use both style of defining default arguments. Try it and you would get a syntax error raised.

Splat arguments

Ruby 1.9 also gives you free hand for defining splat argument anywhere in arguments list

you can also define splat argument as last argument as you used to.

Happy Coding :)