<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>simanman</author_name>
  <author_url>https://blog.hatena.ne.jp/simanman/</author_url>
  <blog_title>simanのブログ</blog_title>
  <blog_url>https://simanman.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>RubyではHashのデフォルト値をHash.newの引数として渡すことで実現できますが、配列を渡すと同じ参照になってしまうのでうまくいきません。 list = Hash.new([]) list[:even] &lt;&lt; 2 p list[:even] #=&gt; [2] list[:odd] &lt;&lt; 3 p list[:odd] #=&gt; [2,3] [2] [2, 3] ですので、配列の場合は少し違う書き方をしないといけません。 list = Hash.new{|hash, key| hash[key] = []} list[:even] &lt;&lt; 2 p list[:even] #=&gt; [2] list…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsimanman.hatenablog.com%2Fentry%2F2013%2F09%2F24%2F211044&quot; title=&quot;Rubyでハッシュのデフォルト値を配列にする - simanのブログ&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>2013-09-24 21:10:44</published>
  <title>Rubyでハッシュのデフォルト値を配列にする</title>
  <type>rich</type>
  <url>https://simanman.hatenablog.com/entry/2013/09/24/211044</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
