On Thu, Mar 20, 2014 at 7:45 PM, Vladimir Rybas <[email protected]> wrote: > 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
I have been generally following the GH style guide, but not the hashrocket thing, unless a client mandates it. One thing to note: Github itself as a huge codebase, the main site still runs Rails 2.x, and it makes sense when you have a long term code base, to keep a consistent style across it. I'm not so sure that one needs to be so slavish to that though if you aren't writing code for GH. -- 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/CAHUC_t8R%3Dr4F76y-S0gG5GAuapqy8vNdVwN0PeSFPzTvOULONA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

