You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I prefer simple strings to symbols and there are a couple of reasons.
Simple strings allows us to pass the json straight in and not have to use to_sym anywhere in the code.
They are also garbage-collectible (although Ruby 2.2 partially solves that problem).
As a side note:
You can't use the new Hash syntax without symbols.
Symbols are not such a good idea when the keys are not a fixed set (providing a json configuration file is by definition creating arbitrary keys).
This relates directly to the fact that symbols are global and (apart from Ruby >2.2) and hold on to their memory forever.
Looking at the README I see only Strings being used as the keys for the config hashes, e.g.:
I'm wondering whether using symbols would be more idiomatic (and also reads better when syntax-highlighted), e.g.:
The text was updated successfully, but these errors were encountered: