{"id":12040,"date":"2020-10-24T09:25:48","date_gmt":"2020-10-24T00:25:48","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=12040"},"modified":"2023-05-27T22:32:04","modified_gmt":"2023-05-27T13:32:04","slug":"%e3%80%90ruby%e3%80%91%e3%80%8c%e3%83%9e%e3%82%b8%e3%83%83%e3%82%af%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%80%8d%e3%81%a8%e3%81%af%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=12040","title":{"rendered":"\u3010Ruby\u3011\u300c\u30b3\u30e1\u30f3\u30c8\u300d\u3001\u300c\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u300d\u3001\u300c\u30de\u30b8\u30c3\u30af\u30b3\u30e1\u30f3\u30c8\u300d\u3068\u306f\uff1f"},"content":{"rendered":"<h2>\u30b3\u30e1\u30f3\u30c8<\/h2>\n<h3>\u5358\u4e00\u884c\u30b3\u30e1\u30f3\u30c8<\/h3>\n<pre class=\"lang:default decode:true\">#\u5358\u4e00\u884c\u30b3\u30e1\u30f3\u30c8<\/pre>\n<h3>\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8<\/h3>\n<pre class=\"lang:default decode:true\">=begin\r\n\u8907\u6570\u884c\r\n\u30b3\u30e1\u30f3\u30c8\r\n=end<\/pre>\n<p>\u4e00\u5fdc\u3001\u3053\u308c\u3067\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8\u3092\u3059\u308b\u3053\u3068\u306f\u53ef\u80fd\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u73fe\u5834\u3067\u4f7f\u308f\u308c\u308b\u3053\u3068\u306f\u7a00\u3067\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000;\"><strong>#\u3092\u8907\u6570\u884c\u5165\u529b\u3057\u3066\u3001\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8\u3068\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u306e\u65b9\u304c\u591a\u3044<\/strong><\/span>\u3067\u3059\u3002<\/p>\n<h2>\u6587\u5b57\u5217\u3092\u6539\u884c\u3057\u3066\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u3002(\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8)<\/h2>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067<span style=\"color: #ff0000;\"><strong>\u6539\u884c\u72b6\u614b\u3092\u4fdd\u3063\u305f\u307e\u307e\u6587\u5b57\u5217\u3092\u5909\u6570\u306b\u4ee3\u5165\u3059\u308b<\/strong><\/span>\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092<span style=\"color: #ff0000;\"><strong>\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/strong><\/span>\u3068\u8a00\u3044\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u6587\u5b57\u5217\u306f\u30c0\u30d6\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3063\u305f\u306e\u3068\u540c\u3058\u52d5\u304d\u3092\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">text = &lt;&lt;EOS\r\n\u3053\u308c\u306f\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\r\n\u30c6\u30b9\u30c8\u3067\u3059\u3002\r\n\u8907\u6570\u884c\u306e\u6587\u5b57\u5217\u3092\u4ee3\u5165\u3059\u308b\u5834\u5408\u306b\u4fbf\u5229\u306a\u8a18\u8ff0\u65b9\u6cd5\u3067\u3059\u3002\r\nEOS\r\nputs text<\/pre>\n<p>\u4efb\u610f\u306e\u6587\u5b57\u5217\u306f\u306a\u3093\u3067\u3082\u3044\u3044\u306e\u3067\u3059\u304c<span style=\"color: #ff0000;\"><strong>EOS(End Of String)<\/strong><\/span>\u304c\u4f7f\u308f\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n<h3>\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u4e2d\u306b\u5909\u6570\u3092\u57cb\u3081\u8fbc\u3080<\/h3>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3059\u308c\u3070\u56fa\u5b9a\u6587\u5b57\u5217\u306e\u4e2d\u306b<span style=\"color: #ff0000;\"><strong>\u5909\u6570\u3092\u57cb\u3081\u8fbc\u3080\u3053\u3068\u3082\u53ef\u80fd<\/strong><\/span>\u3067\u3059\u3002\u958b\u59cb\u6587\u5b57\u306f\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3063\u3066\u3082\u826f\u3044\u3067\u3059\u304c\u3001\u7d42\u7aef\u306e\u6587\u5b57\u306f\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3063\u3066\u306f\u3044\u3051\u307e\u305b\u3093\u3002\uff08\u4e0b\u8a18\u306e\u4f8b\u3067\u306f\u300cEOS\u300d\uff09<\/p>\n<pre class=\"lang:default decode:true\">four = '4'\r\ntext = &lt;&lt;\"EOS\"(\u3082\u3057\u304f\u306fEOS\u3067\u3082\u826f\u3044)\r\n\u3053\u308c\u306f\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\r\n\u30c6\u30b9\u30c8\u3067\u3059\u3002\r\n\u8907\u6570\u884c\u306e\u6587\u5b57\u5217\u3092\u4ee3\u5165\u3059\u308b\u5834\u5408\u306b\u4fbf\u5229\u306a\u8a18\u8ff0\u65b9\u6cd5\u3067\u3059\u3002\r\n\u3053\u306e\u884c\u306f#{four}\u884c\u76ee\u306b\u306a\u308a\u307e\u3059\u3002\r\nEOS\r\nputs text<\/pre>\n<h3>\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u69d8\u3005\u306a\u8a18\u8ff0<\/h3>\n<h4>text = &lt;&lt;\"EOS\"<\/h4>\n<p>\u6587\u5b57\u5217\u3092\u30b7\u30f3\u30b0\u30eb\u30b3\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u3063\u305f\u306e\u3068\u540c\u3058\u52d5\u304d\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<h4>text = &lt;&lt;-\"EOS\"<\/h4>\n<p>\u6587\u5b57\u5217\u3092\u30a4\u30f3\u30c7\u30f3\u30c8\u8fbc\u307f\u3067\u8868\u793a\u3067\u304d\u307e\u3059\u3002\u4e00\u756a\u5de6\u306b\u30d2\u30a2\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u6587\u3092\u8a18\u8ff0\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u3001<span style=\"color: #ff0000;\"><strong>\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u968e\u5c64\u3068\u304b\u3092\u610f\u8b58\u3057\u3066\u5b9f\u88c5\u3057\u305f\u3044\u5834\u5408<\/strong><\/span>\u306f\u3053\u3061\u3089\u306e\u8a18\u8ff0\u65b9\u6cd5\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30de\u30b8\u30c3\u30af\u30b3\u30e1\u30f3\u30c8\u3068\u306f\uff1f<\/h2>\n<p>Ruby\u306b\u304a\u3044\u3066\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\u3002Ruby.2.0\u4ee5\u4e0a\u3067\u3042\u308c\u3070\u30c7\u30d5\u30a9\u30eb\u30c8\u3067UTF-8\u304c\u5165\u3063\u3066\u3044\u308b\u306e\u3067\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>\u57fa\u672c\u7684\u306a\u66f8\u304d\u65b9<\/h3>\n<p>\u6587\u5b57\u30b3\u30fc\u30c9\u306f\u5927\u6587\u5b57\u3068\u5c0f\u6587\u5b57\u306f\u533a\u5225\u3057\u306a\u3044\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\"># encoding: \u6587\u5b57\u30b3\u30fc\u30c9\u540d<\/pre>\n<p>\u307e\u305f\u306f<\/p>\n<pre class=\"lang:default decode:true\"># coding: \u6587\u5b57\u30b3\u30fc\u30c9\u540d<\/pre>\n<h3>UTF-8<\/h3>\n<pre class=\"lang:default decode:true\"># encoding: utf-8<\/pre>\n<h3>Shift-JIS<\/h3>\n<pre class=\"lang:default decode:true\"># encoding: Shift_JIS<\/pre>\n<h3>US-ASCII<\/h3>\n<pre class=\"lang:default decode:true\"># encoding: us-ascii<\/pre>\n<h3>encoding\u30e1\u30bd\u30c3\u30c9<\/h3>\n<p>String\u30af\u30e9\u30b9\u306eencoding\u30e1\u30bd\u30c3\u30c9\u3067\u30c7\u30fc\u30bf\u578b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30b3\u30e1\u30f3\u30c8 \u5358\u4e00\u884c\u30b3\u30e1\u30f3\u30c8 #\u5358\u4e00\u884c\u30b3\u30e1\u30f3\u30c8 \u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8 =begin \u8907\u6570\u884c \u30b3\u30e1\u30f3\u30c8 =end \u4e00\u5fdc\u3001\u3053\u308c\u3067\u8907\u6570\u884c\u30b3\u30e1\u30f3\u30c8\u3092\u3059\u308b\u3053\u3068\u306f\u53ef\u80fd\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u73fe\u5834\u3067\u4f7f\u308f\u308c\u308b\u3053\u3068\u306f\u7a00\u3067\u3059\u3002 #\u3092\u8907\u6570\u884c\u5165\u529b\u3057\u3066\u3001\u8907\u6570\u884c\u30b3\u30e1\u30f3 [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[48],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12040"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12040"}],"version-history":[{"count":8,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12040\/revisions"}],"predecessor-version":[{"id":20470,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12040\/revisions\/20470"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12040"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}