{"id":26575,"date":"2015-01-12T10:22:58","date_gmt":"2015-01-12T01:22:58","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=26575"},"modified":"2015-01-12T10:22:58","modified_gmt":"2015-01-12T01:22:58","slug":"five-ruby-method","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/five-ruby-method\/","title":{"rendered":"Ruby\u3067\u4f7f\u7528\u3059\u3079\u304d5\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u306f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2015\/01\/Iruby1.jpg\" alt=\"Ruby\" title=\"ruby.jpg\" border=\"0\" width=\"546\" height=\"347\" \/><\/p>\n<p>\u300c<a href=\"https:\/\/blog.engineyard.com\/2015\/five-ruby-methods-you-should-be-using\">Five Ruby Methods You Should Be Using<\/a>\u300d\u306fRuby\u30e6\u30fc\u30b6\u30fc\u304c\u7d76\u5bfe\u77e5\u3063\u3066\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u30e1\u30bd\u30c3\u30c95\u3064\u3092\u7d39\u4ecb\u3059\u308b\u30d6\u30ed\u30b0\u8a18\u4e8b\u3002\u300cObject#tap\u300d\u3001\u300cArray#bsearch\u300d\u3001\u300cEnumerable#flat_map\u300d\u3001\u300cArray.new\u3092\u30d6\u30ed\u30c3\u30af\u4ed8\u304d\u3067\u4f7f\u3046\u300d\u3001\u300c<=>\u300d\u306e5\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u53d6\u308a\u4e0a\u3052\u3089\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>Object#tap\u306f<a href=\"http:\/\/qiita.com\/shunsugai@github\/items\/f010189b8993fe6dd81d\">\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3092\u6e1b\u3089\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u30e1\u30ea\u30c3\u30c8<\/a>\u304c\u3042\u308b\u3001Array#bsearch\u306f2\u5206\u63a2\u7d22\u306b\u3088\u308b\u9ad8\u901f\u691c\u7d22\u304c\u53ef\u80fd\u306a\u3069\u306a\u3069\u3001\u9577\u5e74Ruby\u3092\u4f7f\u3063\u3066\u3044\u3066\u3082\u610f\u5916\u3068\u77e5\u3089\u306a\u3044\u30e1\u30bd\u30c3\u30c9\u306e\u4f7f\u3044\u65b9\u304c\u8aac\u660e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"ruby\"># tap\u306a\u3057\ndef update_params(params)\n  params[:foo] = 'bar'\n  params\nend\n\n# tap\u3042\u308a\ndef update_params(params)\n  params.tap {|p| p[:foo] = 'bar' }\nend\n\n<\/code><\/pre>\n<p>\u81ea\u5206\u3067\u4f7f\u308f\u306a\u3044\u3068\u3057\u3066\u3082\u3001\u4ed6\u306e\u4eba\u304c\u4f5c\u3063\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30b3\u30fc\u30c9\u3092\u89e3\u8aad\u3059\u308b\u3068\u304d\u306a\u3069\u306b\u5fc5\u8981\u3068\u306a\u308a\u305d\u3046\u306a\u77e5\u8b58\u306a\u306e\u3067\u3001\u77e5\u3063\u3066\u3044\u304a\u3044\u305f\u307b\u3046\u304c\u3088\u3044\u3053\u3068\u306f\u78ba\u304b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u2026\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cFive Ruby Methods You Should Be Using\u300d\u306fRuby\u30e6\u30fc\u30b6\u30fc\u304c\u7d76\u5bfe\u77e5\u3063\u3066\u3044\u305f\u307b\u3046\u304c\u826f\u3044\u30e1\u30bd\u30c3\u30c95\u3064\u3092\u7d39\u4ecb\u3059\u308b\u30d6\u30ed\u30b0\u8a18\u4e8b\u3002\u300cObject#tap\u300d\u3001\u300cArray#bsearch\u300d\u3001\u300cEn [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":26574,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[75],"tags":[154],"class_list":["post-26575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-ruby"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/26575","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=26575"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/26575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/26574"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=26575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=26575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=26575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}