<?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 には型変換メソッドが沢山用意されているが、あまり暗黙の型変換はしてくれないと書いた。 暗黙の型変換 ところが多重代入をすると Array への型変換をやってくれるらしい。 class Foo def to_a; [:to_a] end def to_ary; [:to, :ary] end end foo = Foo.new # 左辺が複数で右辺がひとつなら to_ary が呼ばれる x, y = foo # =&gt; #&lt;Foo:0x100b3780&gt; x # =&gt; :to y # =&gt; :ary # 明示的に * で展開すると to_a が呼ばれる x, y = *foo # …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmas-higa.hatenadiary.org%2Fentry%2F20090817%2F1250518063&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>2009-08-17 23:07:43</published>
  <title>多重代入と暗黙の型変換</title>
  <type>rich</type>
  <url>https://mas-higa.hatenadiary.org/entry/20090817/1250518063</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
