<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rubyco</author_name>
  <author_url>https://blog.hatena.ne.jp/rubyco/</author_url>
  <blog_title>rubyco（るびこ）の日記</blog_title>
  <blog_url>https://rubyco.hatenadiary.org/</blog_url>
  <categories>
  </categories>
  <description>ハッシュの値がまだ存在しなかったら0を代入し、あったら数を足し込んでいこうと思います。 h = Hash.new if not h[:key] h[:key] = 0 end h[:key] += 123 Hash#key?メソッドを使うべきかしら。 h = Hash.new if not h.key? :key h[:key] = 0 end h[:key] += 123 ハッシュを作るときにHash.new(0)でデフォルト値0を与えておくと「存在しなかったら」というif文が不要になります。 h = Hash.new(0) h[:key] += 123 同じように空の配列をデフォルトにする…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubyco.hatenadiary.org%2Fentry%2F20130607%2Fdefault&quot; title=&quot;ハッシュの値が存在しないときの値（デフォルト値）を設定する - rubyco（るびこ）の日記&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-06-07 00:00:00</published>
  <title>ハッシュの値が存在しないときの値（デフォルト値）を設定する</title>
  <type>rich</type>
  <url>https://rubyco.hatenadiary.org/entry/20130607/default</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
