<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>rubikitch</author_name>
  <author_url>https://blog.hatena.ne.jp/rubikitch/</author_url>
  <blog_title>http://rubikitch.com/に移転しました</blog_title>
  <blog_url>https://rubikitch.hatenadiary.org/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>Ruby 1.9で導入されたObject#tapはRuby 1.8でも1.8.7から使えるようになった。 tapメソッドとは何かというと、自分自身にブロックを作用させて自分自身を返すだけのメソッドだ。つまり副作用専門メソッド。定義はいたって簡単、コレ。 class Object def tap yield(self) self end end たとえば、1〜4の二乗のうち10以上のものを求めたいんだけど、デバッグ時とかで途中経過である1〜4の二乗を表示してほしいなんて場合はこんな感じに。いらなくなったらtapの部分を消せばいい。楽チン。 ary = [1, 2, 3, 4] ary.map{|…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubikitch.hatenadiary.org%2Fentry%2F20080502%2Ftap&quot; title=&quot;tapかわいいよtap - http://rubikitch.com/に移転しました&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>2008-05-02 00:00:00</published>
  <title>tapかわいいよtap</title>
  <type>rich</type>
  <url>https://rubikitch.hatenadiary.org/entry/20080502/tap</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
