Re:RuboCop 0.80: Ruby static code analyzer and code formatter
by hirundo on Tuesday February 18, 2020 @09:48PM
(#22362666)
I prefer the brackets to parens because it makes it more clear at a glance that the result is an array.
Re:RuboCop 0.80: Ruby static code analyzer and code formatter
by block_dagger on Thursday February 20, 2020 @06:44PM
(#22379683)
Shorter. Different code coloring. I prefer %w where possible with or without Rubocop.
Classic example is Perl style %w(literal arrays) vs ['traditional', 'arrays'].
> Prefer `%w` to the literal array syntax when you need an array of strings
Which was introduced[1] into the style guide nearly 9 years ago with practically no reasoning. Prefer `%w` because why exactly?
[1] https://github.com/rubocop-hq/ruby-style-guide/commit/b27eff...