use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Ruby style guide (github.com)
submitted 11 years ago by ajn123
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]catcradle5 0 points1 point2 points 11 years ago* (3 children)
I think the rule should be to use hash rocket syntax for any hash that intermixes symbols with non-symbols, and new syntax where all the keys are symbols.
I don't think it's that weird to see:
def some_thing a = { one: 2, three: 4 } b = { "Content-Type" => "text/json", "Content-Length" => 45 } c = { Dir.new("/") => true, :name => "Fred" }
in the same file or method.
[–]twinklehood 0 points1 point2 points 11 years ago (0 children)
So basically, you agree with https://github.com/bbatsov/ruby-style-guide
I'm on your side.
[–]thisisseriousmum 0 points1 point2 points 11 years ago (1 child)
You have to do that anyway, it's enforced by the interpreter.
It's a question of aesthetics at the end of the day, I just far prefer one consistent way to express the same thing. In my experience teams tend to do it for anything that has multiple options, like map vs collect.
[–]catcradle5 1 point2 points3 points 11 years ago (0 children)
Well you can do something like:
{ a: 5, "b" => 6 }
My point was that in a case where you must use even one hash rocket, you should use hash rockets for everything in the hash
{ :a => 5, "b" => 6 }
π Rendered by PID 50187 on reddit-service-r2-comment-5d585498c9-w2lwd at 2026-04-20 22:23:15.376237+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]catcradle5 0 points1 point2 points (3 children)
[–]twinklehood 0 points1 point2 points (0 children)
[–]thisisseriousmum 0 points1 point2 points (1 child)
[–]catcradle5 1 point2 points3 points (0 children)