<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mas-higa</author_name>
  <author_url>https://blog.hatena.ne.jp/mas-higa/</author_url>
  <blog_title>ひがきの日記</blog_title>
  <blog_url>https://mas-higa.hatenadiary.org/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Ruby ではメソッド名の末尾に = が付いていると、属性への代入のように使える。 def Foo def name=(name) @name = name end end foo = Foo.new # =&gt; #&lt;Foo:0x100c7f98 @name=&quot;&quot;&gt; foo.name = 'foo' # =&gt; &quot;foo&quot; ←ここに注目 foo # =&gt; #&lt;Foo:0x100c7f98 @name=&quot;foo&quot;&gt; つまり代入のように書くと Foo#name=(name) を呼び出してくれる。しかし、Foo#name=(name) が self ではなく name を返してるっぽいのが罠。*1 fo…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmas-higa.hatenadiary.org%2Fentry%2F20100412%2F1271078851&quot; title=&quot;代入メソッドの罠 - ひがきの日記&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>2010-04-12 22:27:31</published>
  <title>代入メソッドの罠</title>
  <type>rich</type>
  <url>https://mas-higa.hatenadiary.org/entry/20100412/1271078851</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
