Is there any difference between :key => \"value\"
(hashrocket) and key: \"value\"
(Ruby 1.9) notations?
If not, then I would like to use
Ruby hash-keys assigned by hash-rockets can facilitate strings for key-value pairs (e.g. 's' => x
) whereas key assignment via symbols (e.g. key: "value"
or :key => "value"
) cannot be assigned with strings. Although hash-rockets provide freedom and functionality for hash-tables, specifically allowing strings as keys, application performance may be slower than if the hash-tables were to be constructed with symbols as hash-keys. The following resources may be able to clarify any differences between hashrockets and symbols: