{"author_url":"https://blog.hatena.ne.jp/te-nu/","title":"Ruby\u306ecoerce\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.te-nu.com%2Fentry%2F2017%2F07%2F15%2F184053\" title=\"Ruby\u306ecoerce\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066 - \u30a6\u30a7\u30d6\u30a8\u30f3\u30b8\u30cb\u30a2\u73cd\u9053\u4e2d\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"Ruby\u306e\u52c9\u5f37\u3057\u3066\u3044\u305f\u3089Numeric#coerce\u30e1\u30bd\u30c3\u30c9\u3068\u3044\u3046\u3082\u306e\u3092\u898b\u3064\u3051\u305f\u306e\u3067\u30e1\u30e2 \u6a5f\u80fd \u5168\u3066\u306e\u6570\u5024\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5bfe\u3057\u3066\u4f7f\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3001\u5f15\u6570\u3067\u4e0e\u3048\u3089\u308c\u305f\u6570\u3092\u81ea\u5206\u3068\u540c\u3058\u30af\u30e9\u30b9\u306b\u3057\u3066\u81ea\u5206\u3068\u30bb\u30c3\u30c8\u3067\u914d\u5217\u3067\u8fd4\u3059\u3082\u306e\u3060\u305d\u3046\u3067\u3059\u3002 hoge = 1.6 hoge.coerce(5) => [5.0, 1.6] \u547c\u3073\u51fa\u3057\u5143\u306e1.6\u306b\u5f15\u6570\u3067\u4e0e\u3048\u3089\u308c\u305f5\u304c\u5909\u63db\u3055\u308c\u3001Integer\u304b\u3089Float\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u9006\u3082\u3067\u304d\u308b\u304b\u306a\u30fc\u3068\u3002 hoge = 2 hoge.coerce(1.6) => [1.6, 2.0] \u306a\u305c\u304bFloat\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u3002 \u306a\u3093\u3067\u3084\u306d\u3093\u3068\u601d\u3044\u3001\u30bd\u30fc\u30b9\u3092\u898b\u305f\u3089\u307e\u3055\u304b\u306eC\u8a00\u8a9e\u304c\u51fa\u3066\u304d\u307e\u3057\u2026","blog_url":"https://www.te-nu.com/","author_name":"te-nu","blog_title":"\u30a6\u30a7\u30d6\u30a8\u30f3\u30b8\u30cb\u30a2\u73cd\u9053\u4e2d","url":"https://www.te-nu.com/entry/2017/07/15/184053","image_url":null,"provider_url":"https://hatena.blog","provider_name":"Hatena Blog","categories":["Ruby"],"version":"1.0","published":"2017-07-15 18:40:53","type":"rich","height":"190"}