{"id":82619,"date":"2020-10-08T09:42:45","date_gmt":"2020-10-08T00:42:45","guid":{"rendered":"https:\/\/www.softantenna.com\/wp\/?p=82619"},"modified":"2020-10-08T09:42:45","modified_gmt":"2020-10-08T00:42:45","slug":"ruby-one-liners-cookbook","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/ruby-one-liners-cookbook\/","title":{"rendered":"Ruby one-liners cookbook - Ruby\u3092\u4f7f\u3063\u305f\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u3067\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3092\u6975\u3081\u305f\u3044\u65b9\u306e\u30af\u30c3\u30af\u30d6\u30c3\u30af"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2020\/10\/s_20201007_162401.jpg\" alt=\"S 20201007 162401\" title=\"s_20201007_162401.jpg\" border=\"0\" width=\"860\" height=\"560\" \/><\/p>\n<p>\u65e5\u672c\u751f\u307e\u308c\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u300cRuby\u300d\u3002<\/p>\n<p>Rails\u3068\u5171\u306bWeb\u30a2\u30d7\u30ea\u7528\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u4f7f\u7528\u3055\u308c\u308b\u4e8b\u3082\u591a\u3044\u8a00\u8a9e\u3067\u3059\u304c\u3001Perl\u306e\u6d41\u308c\u3092\u5f15\u304d\u7d99\u3050\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u7528\u30b9\u30af\u30ea\u30d7\u30c8\u51e6\u7406\u8a00\u8a9e\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p>\u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300c<a href=\"https:\/\/github.com\/learnbyexample\/learn_ruby_oneliners\">Ruby one-liners cookbook<\/a>\u300d\u3082\u3001\u305d\u306e\u3088\u3046\u306aRuby\u3092\u4f7f\u3063\u3066\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u3092\u884c\u3044\u65b9\u306b\u304a\u3059\u3059\u3081\u306eWeb\u30da\u30fc\u30b8\u3067\u3059\u3002\u305f\u3060\u3057\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u5225\u9014\u7528\u610f\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u76f4\u63a5\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u300c\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u300d\u306b\u6ce8\u76ee\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u304c\u7279\u5fb4\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2020\/10\/s_20201007_162454.jpg\" alt=\"S 20201007 162454\" title=\"s_20201007_162454.jpg\" border=\"0\" width=\"891\" height=\"413\" \/><\/p>\n<p>\u540c\u30da\u30fc\u30b8\u306b\u306f\u3001\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u306e\u5c0e\u5165\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b5\u30f3\u30d7\u30eb\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li><code>ruby -e 'puts readlines.uniq' *.txt<\/code> - \u5165\u529b\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30b9\u30c8\u304b\u3089\u884c\u304c\u91cd\u8907\u3057\u3066\u3044\u308b\u5834\u5408\u306b\u306f\u30011\u3064\u306e\u30b3\u30d4\u30fc\u306e\u307f\u3092\u4fdd\u6301\u3059\u308b\u3002<\/li>\n<li><code>ruby -e 'puts readlines.uniq {|s| s.split[1]}' *.txt<\/code> - 2\u756a\u76ee\u306e\u30d5\u30a3\u30fc\u30eb\u30c9\u3092\u91cd\u8907\u57fa\u6e96\u3068\u3057\u3066\u3001\u91cd\u8907\u884c\u306e\u6700\u521d\u306e\u30b3\u30d4\u30fc\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u3002<\/li>\n<li><code>ruby -rcommonregex -ne 'puts CommonRegex.get_links($_)' *.md<\/code> - \u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306eCommonRegexRuby\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u3066URL\u306e\u307f\u3092\u62bd\u51fa\u3059\u308b\u3002<\/li>\n<\/ul>\n<p>grep\u3001sed\u3001awk \u306a\u3069\u306eUNIX\u30c4\u30fc\u30eb\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u7528\u3059\u308b\u5834\u5408\u3068\u6bd4\u8f03\u3057\u3001 Ruby\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306e\u4e3b\u306a\u5229\u70b9\u306f\u3001\u8c4a\u5bcc\u306a\u6a5f\u80fd\u3092\u6301\u3064\u6b63\u898f\u8868\u73fe\u30a8\u30f3\u30b8\u30f3\u3084\u6a19\u6e96\u30e9\u30a4\u30d6\u30e9\u30ea\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u88fd\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u5b58\u5728\u306b\u3042\u308b\u3068\u3001\u540c\u30b5\u30a4\u30c8\u306e\u4f5c\u8005\u306f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u5c0e\u5165\u306e\u5f8c\u306f\u3001\u884c\u306e\u51e6\u7406\u3084\u30d5\u30a3\u30fc\u30eb\u30c9\u30bb\u30d1\u30ec\u30fc\u30bf\u30fc\u3001\u30ec\u30b3\u30fc\u30c9\u30bb\u30d1\u30ec\u30fc\u30bf\u30fc\u3001\u8907\u6570\u30d5\u30a1\u30a4\u30eb\u306e\u5165\u529b\u306e\u53d6\u308a\u6271\u3044\u306a\u3069\u3001\u500b\u5225\u306e\u8a71\u984c\u306b\u95a2\u3059\u308b\u8aac\u660e\u304c\u7d9a\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u540c\u30b5\u30a4\u30c8\u306ePDF\/EPUB\u7248\u304c\u6709\u6599\u3067\u8ca9\u58f2\u3055\u308c\u3066\u3044\u308b\u307b\u304b\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f<a href=\"https:\/\/github.com\/learnbyexample\/learn_ruby_oneliners\">GitHub<\/a>\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002Ruby\u3092\u4f7f\u3063\u305f\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u3092\u6975\u3081\u305f\u3044\u65b9\u306f\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e5\u672c\u751f\u307e\u308c\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u300cRuby\u300d\u3002 Rails\u3068\u5171\u306bWeb\u30a2\u30d7\u30ea\u7528\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u3057\u3066\u4f7f\u7528\u3055\u308c\u308b\u4e8b\u3082\u591a\u3044\u8a00\u8a9e\u3067\u3059\u304c\u3001Perl\u306e\u6d41\u308c\u3092\u5f15\u304d\u7d99\u3050\u30c6\u30ad\u30b9\u30c8\u51e6\u7406\u7528\u30b9\u30af\u30ea\u30d7\u30c8\u51e6\u7406\u8a00\u8a9e\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002 \u672c\u65e5\u7d39\u4ecb [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":82621,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[66],"tags":[154],"class_list":["post-82619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webservice","tag-ruby"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/82619","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=82619"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/82619\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/82621"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=82619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=82619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=82619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}