In the [Github Ruby Styleguide][1] there's a note about Hashes:

`Use hashrocket syntax for Hash literals instead of the JSON style
introduced in 1.9.`

I guess the reason is that if you use hashrocket syntax, you can use
any type as a hash key, while with colon the keys are `Symbol` only.
So, you'll (pretty much) always have two styles in your app.

Strict styleguides are important. What if we all start to do crazy
things like `@VARIABLE` or `CamelCaseConstant = [1, 2, 3]`? (and I've
seen such cases, unfortunately).

But in this particular case with hashes, I personally use mixed style.
So, colon for simple key-value hashes, where value is not a `Symbol`
itself. And hashrocket for mixed DSL hashes with "complex" values.

[1]: https://github.com/styleguide/ruby

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAN%2Bip5xG1Mh%3DbkVi9kuhBuvmRspf7Eocw2WHnF_QRA-4M93Ntg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to