Hash
Hashrocket vs JSON-Style
Hash key can be a string or a symbol.
Using symbols as hash keys is preferred whenever possible.
Every instance of a symbol points to the same object, whereas each instance of a string refers to a unique object.
Using symbols as keys results in slightly better performance and less memory usage.
Symbol Key:#
- This is more popular.
- Access symbol keys:
String Key:#
- Access String keys: