Is there any difference between :key => \"value\"
(hashrocket) and key: \"value\"
(Ruby 1.9) notations?
If not, then I would like to use
Doing :key => value
is the same as doing key: value
, and is really just a convenience. I haven't seen other languages that use the =>
, but others like Javascript use the key: value
in their Hash-equivalent datatypes.
As for a gem to convert the way you wrote out your hashes, I would just stick with the way you are doing it for your current project.
*Note that in using key: value
the key will be a symbol, and to access the value stored at that key in a foo
hash would still be foo[:key]
.