Best practice for sure!
For some reason I didn't understand this. In the end I did it through laziness.
What do the question marks in front of letters mean? (?a..?z)
(?a..?z)
I think this is the best solution, since everything is done here in one loop. Genius!
You can also use the group_by method
group_by
The road will be mastered by the walking one, so don't worry much.
The best ruby-way
The sum method in this case is more concise and works faster than inject.
Use single quotes unless string interpolation is required.
Yes. But another question: is it best practice to use such a non-concise code? You must remember the order of operations. In my opinion, it is really hard to read. I would use parentheses instead.
Loading collection data...
Best practice for sure!
For some reason I didn't understand this. In the end I did it through laziness.
What do the question marks in front of letters mean?
(?a..?z)
I think this is the best solution, since everything is done here in one loop. Genius!
You can also use the
group_by
methodThe road will be mastered by the walking one, so don't worry much.
The best ruby-way
The sum method in this case is more concise and works faster than inject.
Use single quotes unless string interpolation is required.
Yes. But another question: is it best practice to use such a non-concise code? You must remember the order of operations. In my opinion, it is really hard to read. I would use parentheses instead.