|
|
|
|
|
by LanceH
2042 days ago
|
|
Generally in ruby/rails, the people in favor of double quotes would use double quotes all the time. Rubocop would have you use singles for non interpolated and double for interpolated. I get that there is a potential to catch some kind of error where you use double quotes on a string that will interpolated something which it wouldn't if it were in single quotes. In 12 years, I've never had that happen. I have, however, had it happen dozens of times where I changed something from interpolated to not and then I have to bounce over to change the quotes. This happens a lot and is annoying. It's also an eyesore when you have an array of messages, each neatly aligned, but some are interpolated and some aren't, so the quotes change. In Ruby, knowing that a string has interpolation is easy enough by seeing the #{} in the middle of it. It's hard to miss, really. The single/double quote cop which is turned on by default is also counter to the existing style of every-string-is-double when it came along. |
|
{} are not required for instance variables.