<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>a2ikm</author_name>
  <author_url>https://blog.hatena.ne.jp/a2ikm/</author_url>
  <blog_title>There's an echo in my head</blog_title>
  <blog_url>https://ikm.hatenablog.jp/</blog_url>
  <categories>
    <anon>activesupport</anon>
  </categories>
  <description>1年ぐらい前に社内ブログにメモしてた内容をまんま転載。 はて、これはduck typingなのか？ 概要 Object#acts_like?を使うとクラスの異なるオブジェクトが同じ振る舞いをするかどうかの判定が手軽にできるようになる。 具体例 ActiveSupportではTimeとDateTime、ActiveSupport::TimeWithZoneに共通のメソッドを実装し、それらが入れ替わってもうまく動くようになっている。 これを実装するにあたってにTimeっぽく振る舞うかどうかを判定するためにacts_like?を使っている。 require &quot;active_support/all&quot; …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fikm.hatenablog.jp%2Fentry%2F2016%2F10%2F28%2F201248&quot; title=&quot;acts_like?でduck typing - There&amp;#39;s an echo in my head&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>2016-10-28 20:12:48</published>
  <title>acts_like?でduck typing</title>
  <type>rich</type>
  <url>https://ikm.hatenablog.jp/entry/2016/10/28/201248</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
