The hash class freezes keys that are strings:
This can be a problem if you want to use those keys later on...more specifically, if you want to extract and edit those strings:
Unfortunately, those strings will have to be duped or cloned:
Hashes and Frozen Keys
4:07 PM / Comments (2) / by Nick
Tags: ruby
This entry was posted on 4:07 PM and is filed under
ruby
. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
2 comments:
actually, cloned objects of frozen objects are also frozen.
@Architect You're right! Thanks for pointing that out. I've updated the post.
Post a Comment