<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ha-tan</author_name>
  <author_url>https://blog.hatena.ne.jp/ha-tan/</author_url>
  <blog_title>趣味的にっき</blog_title>
  <blog_url>https://ha-tan.hatenadiary.org/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>僕の好きなメソッド No.2、open。 プログラムを書いているとよく対で用いなければならない操作がある(例えば、openとcloseなど)。で、プログラマは対で用いるのをよく忘れるものだ。Rubyではこのような対になる操作とブロックを組み合わせて使うことができる。例えば、ファイルのopenの場合だと次のようになる。 open('foo.txt', 'r') do |file| print file.read endopenにブロックを渡すとブロックの内容を実行した後にcloseを行ってくれる。Javaでfinallyブロックにclose処理を書きましょうとかいうのとは次元の違う便利さだと思う…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fha-tan.hatenadiary.org%2Fentry%2F20050521%2F1116628234&quot; title=&quot; 好きなメソッド #2 open - 趣味的にっき&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>https://cdn-ak.d.st-hatena.com/diary/ha-tan/2005-05-21.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2005-05-21 07:30:34</published>
  <title> 好きなメソッド #2 open</title>
  <type>rich</type>
  <url>https://ha-tan.hatenadiary.org/entry/20050521/1116628234</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
