{"id":56345,"date":"2018-01-16T08:05:09","date_gmt":"2018-01-15T23:05:09","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=56345"},"modified":"2018-01-16T08:05:09","modified_gmt":"2018-01-15T23:05:09","slug":"top-5-reasons-for-ruby-ists-to-use-crystal","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/top-5-reasons-for-ruby-ists-to-use-crystal\/","title":{"rendered":"Ruby\u958b\u767a\u8005\u304cCrystal\u3092\u4f7f\u3046\u3079\u304d5\u3064\u306e\u7406\u7531"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2018\/01\/Ipexels-photo-326240.jpeg\" alt=\"Pexels photo 326240\" title=\"pexels-photo-326240.jpeg\" border=\"0\" width=\"1132\" height=\"750\" \/><\/p>\n<p>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u52d5\u5411\u306b\u8a73\u3057\u3044\u65b9\u306a\u3089\u3070\u300c<a href=\"https:\/\/crystal-lang.org\/\">Crystal<\/a>\u300d\u8a00\u8a9e\u306e\u540d\u524d\u3092\u805e\u3044\u305f\u3053\u3068\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002Ruby\u3068\u4e92\u63db\u6027\u306e\u9ad8\u3044\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3092\u63a1\u7528\u3057\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3088\u308b\u578b\u30c1\u30a7\u30c3\u30af\u3084\u9ad8\u901f\u5b9f\u884c\u304c\u53ef\u80fd\u306a\u5229\u70b9\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306eCrystal\u516c\u5f0f\u30d6\u30ed\u30b0\u306b\u300c<a href=\"https:\/\/crystal-lang.org\/2018\/01\/08\/top-5-reasons-for-ruby-ists-to-use-crystal.html\">Top 5 Reasons for Ruby-ists to Use Crystal(Ruby\u958b\u767a\u8005\u304cCrystal\u3092\u4f7f\u3046\u3079\u304d5\u3064\u306e\u7406\u7531)<\/a>\u300d\u3068\u3044\u3046\u8208\u5473\u6df1\u3044\u60c5\u5831\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u7279\u306bRuby\u958b\u767a\u8005\u306a\u3089\u3070\u30c1\u30a7\u30c3\u30af\u3057\u3066\u304a\u3044\u3066\u640d\u304c\u306a\u3044\u60c5\u5831\u3068\u3044\u3048\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>\u975e\u5e38\u306b\u4f4e\u3044\u5b66\u7fd2\u66f2\u7dda<\/h2>\n<p>Crystal\u306fRuby\u3068\u4e92\u63db\u6027\u306e\u9ad8\u3044\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3092\u63a1\u7528\u3057\u3066\u304a\u308a\u7fd2\u5f97\u304c\u5bb9\u6613\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306fRuby\/Crystal\u3069\u3061\u3089\u3067\u3082\u52d5\u4f5c\u3059\u308b\u3002<\/p>\n<pre>module Year\n  def self.leap?(year)\n    year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)\n  end\nend<\/pre>\n<p>\u5b8c\u5168\u306a\u4e92\u63db\u6027\u304c\u3042\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u304c\u3001Ruby\u306e\u7d4c\u9a13\u304c\u3042\u308c\u3070\u3059\u3050\u306b\u5b9f\u8df5\u306b\u5c0e\u5165\u53ef\u80fd\u3002<\/p>\n<h2>\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306e\u30c1\u30a7\u30c3\u30af\u3068\u30e1\u30bd\u30c3\u30c9\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0<\/h2>\n<p>Crystal\u8a00\u8a9e\u3067\u306f\u5165\u529b\u3068\u51fa\u529b\u306e\u578b\u304c\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u30c1\u30a7\u30c3\u30af\u3055\u308c\u308b\u3002<\/p>\n<p>\u30e1\u30bd\u30c3\u30c9\u306b\u5f15\u6570\u306e\u578b\u3092\u6307\u5b9a\u3057\u3066\u30aa\u30fc\u30d0\u30fc\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3002<\/p>\n<pre>def self.leap?(year : Int)\n    year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)\n  end\n\n  def self.leap?(time : Time)\n    self.leap?(time.year)\n  end\nend<\/pre>\n<h2>\u6975\u3081\u3066\u9ad8\u901f<\/h2>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u306b\u3088\u308b\u305d\u306e\u4ed6\u306e\u5229\u70b9\u3068\u3057\u3066\u901f\u5ea6\u3068\u6700\u9069\u5316\u304c\u3042\u308b\u3002<a href=\"https:\/\/github.com\/marksiemers\/ruby-to-crystal\/blob\/master\/src\/enumerables\/reduce_bench.cr\">\u4e71\u6570\u751f\u6210\u306e\u30b5\u30f3\u30d7\u30eb<\/a>\u3067\u306f10\u6841\u306e\u898f\u6a21\u3067Crystal\u304cRuby\u3088\u308a\u9ad8\u901f\u3002\u7d44\u307f\u8fbc\u307f\u306eHTTP\u30b5\u30fc\u30d0\u30fc\u306f200\u4e07\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u4e00\u79d2\u9593\u306b\u51e6\u7406\u3067\u304d\u308b\u3002<\/p>\n<h2>Web\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3082\u3059\u3067\u306b\u5b58\u5728<\/h2>\n<p>Rails\u306e\u3088\u3046\u306a\u7d71\u5408\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3057\u3066\u306f<a href=\"https:\/\/amberframework.org\/\">Amber<\/a>\u304c\u3001Sinatra\u306e\u3088\u3046\u306a\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u6027\u304c\u597d\u307f\u306a\u3089\u3070<a href=\"http:\/\/kemalcr.com\/\">Kemal<\/a>\u304c\u3042\u308b\u3002<\/p>\n<p>\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306e\u578b\u30c1\u30a7\u30c3\u30af\u3084HTTP\u30e1\u30bd\u30c3\u30c9\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30af\u30a8\u30ea\u306a\u3069\u3092\u5b9f\u88c5\u3057\u305f\u30d5\u30eb\u30b9\u30bf\u30c3\u30af\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<a href=\"https:\/\/luckyframework.org\/\">Lucky<\/a>\u3082\u5b58\u5728\u3002<\/p>\n<h2>Crystal\u306fCrystal\u3067\u66f8\u3051\u308b<\/h2>\n<p>Crystal\u8a00\u8a9e\u306fCrystal\u8a00\u8a9e\u3067\u4f5c\u3089\u308c\u3066\u3044\u308b\u3002\u4f8b\u3048\u3070Ruby\u306eEnumerable#all?\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3060\u304c\u3001<\/p>\n<pre>static VALUE\nenum_all(int argc, VALUE *argv, VALUE obj)\n{\n    struct MEMO *memo = MEMO_ENUM_NEW(Qtrue);\n    rb_block_call(obj, id_each, 0, 0, ENUMFUNC(all), (VALUE)memo);\n    return memo->v1;\n}<\/pre>\n<p>Crystal\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u30b7\u30f3\u30d7\u30eb\u3060\u3002<\/p>\n<pre>def all?\n  each { |e| return false unless yield e }\n  true\nend<\/pre>\n<p>Ruby\u306f30.6%\u304cC\u306764.8%\u304cRuby\u3067\u66f8\u304b\u308c\u3066\u3044\u308b\u306e\u306b\u5bfe\u3057\u3001Crystal\u306f0.3%\u304cC++\u306798.4%\u304cCrystal\u3067\u66f8\u304b\u308c\u3066\u3044\u308b\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>Crystal\u306fRuby\u958b\u767a\u8005\u306b\u99b4\u67d3\u307f\u3084\u3059\u3044\u6587\u6cd5\u3092\u63a1\u7528\u3057\u3066\u3044\u308b\u306e\u306b\u52a0\u3048\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3088\u308b\u578b\u30c1\u30a7\u30c3\u30af\u3084\u9ad8\u901f\u52d5\u4f5c\u306a\u3069\u512a\u308c\u305f\u7279\u5fb4\u3092\u3044\u304f\u3064\u304b\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.tiobe.com\/tiobe-index\/\">TIOBE Index for January 2018<\/a>\u3067\u306f\u3001\u307e\u306050\u4f4d\u4ee5\u5185\u306b\u5165\u3063\u3066\u3044\u306a\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067\u3059\u304c(51\u301c100\u4f4d\u306eNext 50\u306b\u306f\u9078\u3070\u308c\u3066\u3044\u307e\u3059)\u3001\u4eca\u5f8c\u306e\u767a\u5c55\u306b\u671f\u5f85\u3067\u304d\u305d\u3046\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u52d5\u5411\u306b\u8a73\u3057\u3044\u65b9\u306a\u3089\u3070\u300cCrystal\u300d\u8a00\u8a9e\u306e\u540d\u524d\u3092\u805e\u3044\u305f\u3053\u3068\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002Ruby\u3068\u4e92\u63db\u6027\u306e\u9ad8\u3044\u30b7\u30f3\u30bf\u30c3\u30af\u30b9\u3092\u63a1\u7528\u3057\u3001\u30b3\u30f3\u30d1\u30a4\u30e9\u306b\u3088\u308b\u578b\u30c1\u30a7\u30c3\u30af\u3084\u9ad8\u901f\u5b9f\u884c\u304c\u53ef\u80fd\u306a\u5229\u70b9\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002 \u3053\u306eCr [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":56351,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[1485],"class_list":["post-56345","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-crystal"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/56345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=56345"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/56345\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/56351"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=56345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=56345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=56345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}