Skip to content

Comment on Github Ruby Styleguide

Comments

I use pretty much the same style for my Ruby work. One thing I do differently is replacing

  %w(word1 word2 word3)
with
  %w[word1 word2 word3]
both result in
  ["word1", "word2", "word3"]
I prefer the bracket delimiters since they better indicate the array nature than the parens. In % notation you can choose your own delimiters, so why not use brackets?

Both are fine.

Just don't use linebreaks or weird utf8 characters, please.

EDIT: As delimeters. Feel free to use them inside the strings.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.