[Rock-dev] One element of Ruby syntax

Sylvain Joyeux bir.sylvain at gmail.com
Thu Oct 9 01:30:09 CEST 2014


Ruby 2.0 introduced keyword arguments. The syntax used for them is:

  function(name: value)

which replaces the old familiar hash syntax when the key is a symbol
(which is the common 'keyword argument' case)

  function(:name => value)

I strongly suggest that you start using the former instead of the
latter in your ruby scripts. 2.0 and 2.1 both have backward
compatibility built-in (for keyword arguments), but it will disappear
at some point. Rock developers should definitely start converting the
old syntax to the new one bit by bit.

Sylvain


More information about the Rock-dev mailing list