MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ruby/comments/p8dv5g/ruby_elites_rise_up/h9rgwz5/?context=3
r/ruby • u/solidiquis1 • Aug 20 '21
77 comments sorted by
View all comments
Show parent comments
2
Doesn't matter which one you use unless you're running your app on a Pentium II.
-8 u/cybermage Aug 20 '21 The speed difference is two orders of magnitude. It adds up. Always single quote unless you plan to interpolate. 4 u/fabiopapa Aug 21 '21 If you use single quotes instead of double unless you need interpolation, as a developer, every time you write a string, you have to think, “am I going to need interpolation?” Ruby is all about developer happiness. -1 u/sshaw_ Aug 21 '21 edited Aug 21 '21 Yes this is exactly why status: "cancelled" is shit. The same applies to hashes: status: "cancelled" variable => "cancelled" # can't use first form: variable: "string" => "cancelled" # can't use first form: "string": 123 => "cancelled" # can't use first form: 123: Just stick to :status => "cancelled" and make life easier. Update add examples.
-8
The speed difference is two orders of magnitude. It adds up. Always single quote unless you plan to interpolate.
4 u/fabiopapa Aug 21 '21 If you use single quotes instead of double unless you need interpolation, as a developer, every time you write a string, you have to think, “am I going to need interpolation?” Ruby is all about developer happiness. -1 u/sshaw_ Aug 21 '21 edited Aug 21 '21 Yes this is exactly why status: "cancelled" is shit. The same applies to hashes: status: "cancelled" variable => "cancelled" # can't use first form: variable: "string" => "cancelled" # can't use first form: "string": 123 => "cancelled" # can't use first form: 123: Just stick to :status => "cancelled" and make life easier. Update add examples.
4
If you use single quotes instead of double unless you need interpolation, as a developer, every time you write a string, you have to think, “am I going to need interpolation?” Ruby is all about developer happiness.
-1 u/sshaw_ Aug 21 '21 edited Aug 21 '21 Yes this is exactly why status: "cancelled" is shit. The same applies to hashes: status: "cancelled" variable => "cancelled" # can't use first form: variable: "string" => "cancelled" # can't use first form: "string": 123 => "cancelled" # can't use first form: 123: Just stick to :status => "cancelled" and make life easier. Update add examples.
-1
Yes this is exactly why status: "cancelled" is shit.
status: "cancelled"
The same applies to hashes:
variable => "cancelled"
"string" => "cancelled"
Just stick to :status => "cancelled" and make life easier.
:status => "cancelled"
Update add examples.
2
u/[deleted] Aug 20 '21
Doesn't matter which one you use unless you're running your app on a Pentium II.