Pankaj Bagwan
Pankaj Bagwan
~1 min read

Categories

Tags

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 :)


About The Author

I am Pankaj Baagwan, a System Design Architect. A Computer Scientist by heart, process enthusiast, and open source author/contributor/writer. Advocates Karma. Love working with cutting edge, fascinating, open source technologies.

  • To consult Pankaj Bagwan on System Design, Cyber Security and Application Development, SEO and SMO, please reach out at me[at]bagwanpankaj[dot]com

  • For promotion/advertisement of your services and products on this blog, please reach out at me[at]bagwanpankaj[dot]com

Stay tuned <3. Signing off for RAAM