<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>thinca</author_name>
  <author_url>https://blog.hatena.ne.jp/thinca/</author_url>
  <blog_title>永遠に未完成</blog_title>
  <blog_url>https://thinca.hatenablog.com/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>hash = {a: 1, b: 2, c: 3} hash2 = hash.map {|k, v| [k, v * 2] }.to_h p hash2 # =&gt; {a: 2, b: 4, c: 6} めんどくさい。Scala には mapValues というのがあるらしい。Ruby で書くならこうかな。 class Hash def map_values(&amp;block) dup.map_values!(&amp;block) end def map_values!(&amp;block) update(self) {|_, v| block.call(v) } end end hash = {a: 1, b…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fthinca.hatenablog.com%2Fentry%2F20150215%2F1423965924&quot; title=&quot; Ruby の Hash で値だけ map で変換したかった - 永遠に未完成&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2015-02-15 11:05:24</published>
  <title> Ruby の Hash で値だけ map で変換したかった</title>
  <type>rich</type>
  <url>https://thinca.hatenablog.com/entry/20150215/1423965924</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
