
tenderlovemaking.com/2015/02/11/weird-stuff-with-hashes
Preview meta tags from the tenderlovemaking.com website.
Linked Hostnames
3Search Engine Appearance
Weird stuff with hashes
Ok, so this isn’t really weird stuff, I don’t think. But maybe people don’t know about it so I thought I would post. Hashes dup string keys When you assign a string key to a hash, the hash copies the string and freezes it. Here is an example: >> x = 'string' => "string" >> y = {} => {} >> y[x] = :value => :value >> { x => y.keys.first } => {"string"=>"string"} >> { x.object_id => y.keys.first.object_id } => {70157126548460=>70157126526760} # object ids are different >> { x.frozen? => y.keys.first.frozen? } => {false=>true} # frozen value is different You can prevent the string from being duped by freezing the string before putting it in the hash:
Bing
Weird stuff with hashes
Ok, so this isn’t really weird stuff, I don’t think. But maybe people don’t know about it so I thought I would post. Hashes dup string keys When you assign a string key to a hash, the hash copies the string and freezes it. Here is an example: >> x = 'string' => "string" >> y = {} => {} >> y[x] = :value => :value >> { x => y.keys.first } => {"string"=>"string"} >> { x.object_id => y.keys.first.object_id } => {70157126548460=>70157126526760} # object ids are different >> { x.frozen? => y.keys.first.frozen? } => {false=>true} # frozen value is different You can prevent the string from being duped by freezing the string before putting it in the hash:
DuckDuckGo

Weird stuff with hashes
Ok, so this isn’t really weird stuff, I don’t think. But maybe people don’t know about it so I thought I would post. Hashes dup string keys When you assign a string key to a hash, the hash copies the string and freezes it. Here is an example: >> x = 'string' => "string" >> y = {} => {} >> y[x] = :value => :value >> { x => y.keys.first } => {"string"=>"string"} >> { x.object_id => y.keys.first.object_id } => {70157126548460=>70157126526760} # object ids are different >> { x.frozen? => y.keys.first.frozen? } => {false=>true} # frozen value is different You can prevent the string from being duped by freezing the string before putting it in the hash:
General Meta Tags
7- titleTenderlove Making - Weird stuff with hashes
- Content-Typetext/html; charset=utf-8
- viewportwidth=device-width, initial-scale=1.0
- article:sectionposts
- article:published_time2015-02-11T09:45:25-08:00
Open Graph Meta Tags
6- og:urlhttps://tenderlovemaking.com/2015/02/11/weird-stuff-with-hashes/
- og:site_nameTenderlove Making
- og:titleWeird stuff with hashes
- og:descriptionOk, so this isn’t really weird stuff, I don’t think. But maybe people don’t know about it so I thought I would post. Hashes dup string keys When you assign a string key to a hash, the hash copies the string and freezes it. Here is an example: >> x = 'string' => "string" >> y = {} => {} >> y[x] = :value => :value >> { x => y.keys.first } => {"string"=>"string"} >> { x.object_id => y.keys.first.object_id } => {70157126548460=>70157126526760} # object ids are different >> { x.frozen? => y.keys.first.frozen? } => {false=>true} # frozen value is different You can prevent the string from being duped by freezing the string before putting it in the hash:
og:locale
en_us
Link Tags
5- alternate/atom.xml
- apple-touch-icon/apple-touch-icon.png
- icon/favicon.ico
- stylesheet/stylesheet/syntax.css
- stylesheet/stylesheet/main.css
Links
6- https://github.com/eileencodes
- https://github.com/rack/rack/pull/795/files#diff-7c1a24d5b2fe58a6f925c7cacc6c55e7R499
- https://mastodon.social/@tenderlove
- https://tenderlovemaking.com
- https://tenderlovemaking.com/2015/02/11/weird-stuff-with-hashes