<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>te-nu</author_name>
  <author_url>https://blog.hatena.ne.jp/te-nu/</author_url>
  <blog_title>ウェブエンジニア珍道中</blog_title>
  <blog_url>https://www.te-nu.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>Rubyの勉強していたらNumeric#coerceメソッドというものを見つけたのでメモ 機能 全ての数値オブジェクトに対して使えるメソッドで、引数で与えられた数を自分と同じクラスにして自分とセットで配列で返すものだそうです。 hoge = 1.6 hoge.coerce(5) =&gt; [5.0, 1.6] 呼び出し元の1.6に引数で与えられた5が変換され、IntegerからFloatになりました。 逆もできるかなーと。 hoge = 2 hoge.coerce(1.6) =&gt; [1.6, 2.0] なぜかFloatになってしまった。 なんでやねんと思い、ソースを見たらまさかのC言語が出てきまし…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.te-nu.com%2Fentry%2F2017%2F07%2F15%2F184053&quot; title=&quot;Rubyのcoerceメソッドについて - ウェブエンジニア珍道中&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>2017-07-15 18:40:53</published>
  <title>Rubyのcoerceメソッドについて</title>
  <type>rich</type>
  <url>https://www.te-nu.com/entry/2017/07/15/184053</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
