Should I use ?
{ :first_name => "Mathieu", :last_name => "Jackson" }
or
{ first_name: "Mathieu", last_name: "Jackson" }
There is no difference between the two, so it is personal preference. Though I would expect most people writing new code for 2.0 will use the second format.
It's important to note that if you are developing for open-source / public consumption and want a wide user base you should use the "old" style of hashes. Ruby 1.8.x, as well as JRuby and other ruby implementations apart from RMI, does not support the terse syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With