<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mgi</author_name>
  <author_url>https://blog.hatena.ne.jp/mgi/</author_url>
  <blog_title>scramble cadenza</blog_title>
  <blog_url>https://mgi.hatenablog.com/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>each の中とかで、いきなり h[&quot;1&quot;][&quot;2&quot;] = 2 とかやりたいときの話。 Hash.new して上記のようなことをやろうとすると、エラーになってしまう。 rakkyooの備忘録 では以下のような書き方があるよーと紹介されている。 # 2次元ハッシュの初期化 h = Hash.new { |hash,key| hash[key] = Hash.new {} } # 3次元ハッシュの初期化 h = Hash.new { |hash,key| hash[key] = Hash.new { |hash,key| hash[key] = {} } } h[&quot;1&quot;][&quot;2&quot;][&quot;3&quot;] = …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmgi.hatenablog.com%2Fentry%2F2013%2F07%2F21%2F211636&quot; title=&quot;ruby で 多次元hash の初期化するときの話 - scramble cadenza&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-07-21 21:16:36</published>
  <title>ruby で 多次元hash の初期化するときの話</title>
  <type>rich</type>
  <url>https://mgi.hatenablog.com/entry/2013/07/21/211636</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
