{"id":40261,"date":"2025-11-03T06:35:32","date_gmt":"2025-11-03T06:35:32","guid":{"rendered":"https:\/\/www.railscarma.com\/?p=40261"},"modified":"2025-11-03T06:41:24","modified_gmt":"2025-11-03T06:41:24","slug":"%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%83%ab%e3%83%93%e3%83%bc%e5%88%97%e6%8c%99%e5%8f%af%e8%83%bd%e3%81%aa%e5%90%84%e3%83%9e%e3%83%83%e3%83%97%e3%81%a8%e9%81%b8%e6%8a%9e","status":"publish","type":"post","link":"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/%e3%83%9e%e3%82%b9%e3%82%bf%e3%83%bc%e3%83%ab%e3%83%93%e3%83%bc%e5%88%97%e6%8c%99%e5%8f%af%e8%83%bd%e3%81%aa%e5%90%84%e3%83%9e%e3%83%83%e3%83%97%e3%81%a8%e9%81%b8%e6%8a%9e\/","title":{"rendered":"\u30de\u30b9\u30bf\u30fcRuby\u5217\u6319\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\uff1aeach\u3001map\u3001select"},"content":{"rendered":"<div data-elementor-type=\"wp-post\" data-elementor-id=\"40261\" class=\"elementor elementor-40261\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a6fa11e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a6fa11e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2dc11c6\" data-id=\"2dc11c6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-08c4140 elementor-widget elementor-widget-text-editor\" data-id=\"08c4140\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u30eb\u30d3\u30fc <strong>\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd<\/strong> \u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u8868\u73fe\u529b\u8c4a\u304b\u306a\u95a2\u6570\u578b\u53cd\u5fa9\u51e6\u7406\u3092\u652f\u3048\u308b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3060\u3002\u306b\u6df7\u5728\u3057\u3066\u3044\u308b\u3002 <code>\u914d\u5217\u3001\u30cf\u30c3\u30b7\u30e5\u3001\u7bc4\u56f2\u3001\u96c6\u5408<\/code>, \u3068\u30ab\u30b9\u30bf\u30e0\u30fb\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30af\u30ea\u30fc\u30f3\u3067\u52b9\u7387\u7684\u306a\u30c7\u30fc\u30bf\u51e6\u7406\u304c\u53ef\u80fd\u306b\u306a\u308b\u3002.&nbsp;<span style=\"font-size: 16px;\">\u30a8\u30ad\u30b9\u30d1\u30fc\u30c8\u306b\u3088\u308bRuby\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5f37\u5316 <\/span><strong data-start=\"39\" data-end=\"68\" style=\"font-size: 16px;\"><a href=\"https:\/\/www.railscarma.com\/ja\/ruby-on-rails%e3%82%b3%e3%83%b3%e3%82%b5%e3%83%ab%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0\/\">Rails\u30b3\u30f3\u30b5\u30eb\u30c6\u30a3\u30f3\u30b0\u30b5\u30fc\u30d3\u30b9<\/a><\/strong><span style=\"font-size: 16px;\">, \u3088\u308a\u30af\u30ea\u30fc\u30f3\u3067\u9ad8\u6027\u80fd\u306a\u30b3\u30fc\u30c9\u306e\u305f\u3081\u306b\u3001\u5404\u30de\u30c3\u30d7\u3001\u30bb\u30ec\u30af\u30c8\u3092\u6700\u9069\u5316\u3059\u308b\u3002.<\/span><\/p>\n<article class=\"text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;:has([data-writing-block])&gt;*]:pointer-events-auto [content-visibility:auto] supports-[content-visibility:auto]:[contain-intrinsic-size:auto_100lvh] scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]\" tabindex=\"-1\" dir=\"auto\" data-turn-id=\"request-6902f6ea-1f18-8321-bec2-c21e0beed250-7\" data-testid=\"conversation-turn-74\" data-scroll-anchor=\"true\" data-turn=\"assistant\">\n<div class=\"text-base my-auto mx-auto pb-10 [--thread-content-margin:--spacing(4)] thread-sm:[--thread-content-margin:--spacing(6)] thread-lg:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)\">\n<div class=\"[--thread-content-max-width:40rem] thread-lg:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group\/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn\" tabindex=\"-1\">\n<div class=\"z-0 flex min-h-[46px] justify-start\"><\/div>\n<div class=\"mt-3 w-full empty:hidden\">\n<div class=\"text-center\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n<div aria-hidden=\"true\" data-edge=\"true\" class=\"pointer-events-none h-px w-px\"><\/div>\n<h2><strong>Ruby\u5217\u6319\u53ef\u80fd\uff1a\u57fa\u790e<\/strong><\/h2>\n<p>\u4f7f\u7528\u65b9\u6cd5 <strong>\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd<\/strong>, \u3092\u5b9a\u7fa9\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002 <code>\u5404<\/code>:<\/p>\n<pre>\u30eb\u30d3\u30fc\n\u30af\u30e9\u30b9 ShoppingList\n  \u30a4\u30f3\u30af\u30eb\u30fc\u30c9 Enumerable\n\n  def initialize(*items)\n    \u30a2\u30a4\u30c6\u30e0 = \u30a2\u30a4\u30c6\u30e0\n  \u7d42\u4e86\n\n  def each(&amp;block)\n    items.each(&amp;block)\n  end\nend<\/pre>\n<p>\u73fe\u5728 <code>\u30b7\u30e7\u30c3\u30d4\u30f3\u30b0\u30ea\u30b9\u30c8<\/code> \u30b5\u30dd\u30fc\u30c8 <strong>\u3059\u3079\u3066 Ruby \u5217\u6319\u53ef\u80fd<\/strong> \u306e\u30e1\u30bd\u30c3\u30c9\u304c\u3042\u308b\u3002.<\/p>\n<h2><strong>\u30eb\u30d3\u30fc\u306e\u5217\u6319\u53ef\u80fd\uff1a <\/strong><code>\u5404<\/code><strong> - \u9805\u76ee\u3054\u3068\u306b\u5b9f\u884c<\/strong><\/h2>\n<h4><strong>\u4f55 <\/strong><code>\u5404<\/code><strong> \u3069\u3046\u3060\u308d\u3046\uff1f<\/strong><\/h4>\n<p>\u3059\u3079\u3066\u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u30d6\u30ed\u30c3\u30af\u3092\u5b9f\u884c\u3059\u308b\u3002. <strong>\u5143\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u8fd4\u3057\u307e\u3059\u3002.<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\n[1, 2, 3].each { |n| puts n * 2 }.\n# \u51fa\u529b\uff1a\n# 2\n# 4\n# 6\n# \u623b\u308a\u5024[1, 2, 3]<\/pre>\n<h4><strong>Ruby\u306eEnumerable\u3092\u4f7f\u3046\u3068\u304d <\/strong><code>\u5404<\/code><\/h4>\n<ul>\n<li>\u30ed\u30b0\u307e\u305f\u306f\u5370\u5237<\/li>\n<li>\u526f\u4f5c\u7528\u306e\u30c8\u30ea\u30ac\u30fc\uff08\u96fb\u5b50\u30e1\u30fc\u30eb\u3001API\u30b3\u30fc\u30eb\uff09<\/li>\n<li>\u5916\u90e8\u72b6\u614b\u306e\u84c4\u7a4d<\/li>\n<\/ul>\n<pre>\u30eb\u30d3\u30fc\n\u5408\u8a08 = 0\n[10, 20, 30].each { |n| total += n }.\nputs total # =&gt; 60<\/pre>\n<p><strong><em>\u843d\u3068\u3057\u7a74<\/em><\/strong><em><strong>:<\/strong> \u6c7a\u3057\u3066\u4f7f\u7528\u3057\u306a\u3044\u3053\u3068 <\/em><em><code>\u5404<\/code> \u5909\u63db\u3055\u308c\u305f\u914d\u5217\u3092\u671f\u5f85\u3059\u308b\u3002.<\/em><\/p>\n<pre>\u30eb\u30d3\u30fc\n# \u9593\u9055\u3044\n[1, 2, 3].each { |n| n * 2 }.# =&gt; [1, 2, 3] \u3067\u3059\u3002<\/pre>\n<h2><strong>\u30eb\u30d3\u30fc\u306e\u5217\u6319\u53ef\u80fd\uff1a <\/strong><code>\u5730\u56f3<\/code><strong> (\u307e\u305f\u306f <\/strong><code>\u96c6\u3081\u308b<\/code><strong>) - \u3042\u3089\u3086\u308b\u30a2\u30a4\u30c6\u30e0\u3092\u5909\u8eab\u3055\u305b\u308b<\/strong><\/h2>\n<h4><strong>\u4f55 <\/strong><code>\u5730\u56f3<\/code><strong> \u3069\u3046\u3060\u308d\u3046\uff1f<\/strong><\/h4>\n<p>\u30d6\u30ed\u30c3\u30af\u3068 <strong>\u65b0\u3057\u3044\u914d\u5217\u3092\u8fd4\u3059<\/strong> \u7d50\u679c\u306e.<\/p>\n<pre>\u30eb\u30d3\u30fc\n[1, 2, 3].map { |n| n * 2 }.# =&gt; [2, 4, 6].<\/pre>\n<h4><strong>Ruby\u306eEnumerable\u3092\u4f7f\u3046\u3068\u304d <\/strong><code>\u5730\u56f3<\/code><\/h4>\n<ul>\n<li>\u30c7\u30fc\u30bf\u578b\u306e\u5909\u63db<\/li>\n<li>\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u62bd\u51fa<\/li>\n<li>\u65b0\u3057\u3044\u69cb\u9020\u7269\u306e\u5efa\u8a2d<\/li>\n<\/ul>\n<h4><strong>\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd <\/strong><code>\u5730\u56f3<\/code><strong> \u4f8b<\/strong><\/h4>\n<p><strong>\u540d\u524d\u3092\u5927\u6587\u5b57\u306b\u3059\u308b<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\n[\"alice\", \"bob\"].map(&amp;:upcase) # =&gt; [\"ALICE\", \"BOB\"].<\/pre>\n<p><strong>\u30e6\u30fc\u30b6\u30fcE\u30e1\u30fc\u30eb\u306e\u62bd\u51fa<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\nusers = [{email: \"a@x.com\"}, {email: \"b@x.com\"}].\nusers.\u30de\u30c3\u30d7 { |u| u[:email] }.# =&gt; [\"a@x.com\", \"b@x.com\"].<\/pre>\n<p><strong>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4ed8\u304d<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\nfruits = [\"apple\", \"banana\"] \u30d5\u30eb\u30fc\u30c4 = [\"\u30ea\u30f3\u30b4\", \"\u30d0\u30ca\u30ca\nfruits.map.with_index { |f, i| \"#{i + 1}.#{f}\"}\n# =&gt; [\"1. \u30ea\u30f3\u30b4\", \"2. \u30d0\u30ca\u30ca\"].<\/pre>\n<p><strong><em>\u843d\u3068\u3057\u7a74<\/em><\/strong><em>:\u4f7f\u7528\u3057\u306a\u3044 <\/em><em><code>\u5730\u56f3<\/code> \u526f\u4f5c\u7528\u306e\u305f\u3081\u3060\u3051\u3067\u3042\u308b\u3002.<\/em><\/p>\n<pre>\u30eb\u30d3\u30fc\n# [nil, nil, nil] \u3092\u8fd4\u3059\u3002\n[1, 2, 3].map { |n| puts n }.<\/pre>\n<h2><strong>\u30eb\u30d3\u30fc\u306e\u5217\u6319\u53ef\u80fd\uff1a <\/strong><code>\u9078\u629e\u3059\u308b<\/code><strong> (\u307e\u305f\u306f <\/strong><code>find_all<\/code><strong>) - \u4e00\u81f4\u3059\u308b\u9805\u76ee\u3092\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3059\u308b<\/strong><\/h2>\n<h4><strong>\u4f55 <\/strong><code>\u9078\u629e\u3059\u308b<\/code><strong> \u3069\u3046\u3060\u308d\u3046\uff1f<\/strong><\/h4>\n<p>\u3092\u8fd4\u3057\u307e\u3059\u3002 <strong>\u65b0\u3057\u3044\u914d\u5217<\/strong> \u30d6\u30ed\u30c3\u30af\u304c\u8fd4\u3059\u8981\u7d20\u306e <code>\u771f\u5b9f<\/code>.<\/p>\n<pre>\u30eb\u30d3\u30fc\n[1, 2, 3, 4].select(&amp;:even?) # =&gt; [2, 4].<\/pre>\n<h4><strong>Ruby\u306eEnumerable\u3092\u4f7f\u3046\u3068\u304d <\/strong><code>\u9078\u629e\u3059\u308b<\/code><\/h4>\n<ul>\n<li>\u6709\u52b9\u306a\u30ec\u30b3\u30fc\u30c9\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0<\/li>\n<li>\u30c7\u30fc\u30bf\u7167\u4f1a<\/li>\n<li>\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u30b5\u30d6\u30bb\u30c3\u30c8<\/li>\n<\/ul>\n<h4><strong>\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd <\/strong><code>\u9078\u629e\u3059\u308b<\/code><strong> \u4f8b<\/strong><\/h4>\n<p><strong>\u5408\u683c\u30b9\u30b3\u30a2<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\n\u30b9\u30b3\u30a2 = [89, 45, 92, 61\uff3d\nscore.select { |s| s &gt;= 70 }.# =&gt; [89, 92] \u3067\u3059\u3002<\/pre>\n<p><strong>\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc<\/strong><\/p>\n<pre>\u30eb\u30d3\u30fc\n\u30e6\u30fc\u30b6\u30fc = [\n  {name: \"Alice\", active: true}\u3001\n  {name: \"Bob\", active: false}.\n]\nusers.select { |u| u[:active] }.# =&gt; [{name: \"Alice\", active: true}] \u3067\u3059\u3002<\/pre>\n<p><strong>\u53cd\u5bfe\u5074\uff1a <\/strong><code>\u62d2\u5426\u3059\u308b<\/code><\/p>\n<pre>\u30eb\u30d3\u30fc\n[1, 2, 3, 4].reject(&amp;:even?) # =&gt; [1, 3].<\/pre>\n<h2><strong>Ruby\u306e\u5217\u6319\u53ef\u80fd\uff1a\u4e3b\u306a\u9055\u3044<\/strong><\/h2>\n<table>\n<tbody>\n<tr>\n<th>\u65b9\u6cd5<\/th>\n<th>\u30ea\u30bf\u30fc\u30f3<\/th>\n<th>\u76ee\u7684<\/th>\n<\/tr>\n<tr>\n<td><code>\u5404<\/code><\/td>\n<td>\u30aa\u30ea\u30b8\u30ca\u30eb\u30fb\u30b3\u30ec\u30af\u30b7\u30e7\u30f3<\/td>\n<td>\u526f\u4f5c\u7528<\/td>\n<\/tr>\n<tr>\n<td><code>\u5730\u56f3<\/code><\/td>\n<td>\u5909\u63db\u3055\u308c\u305f\u5024\u306e\u65b0\u3057\u3044\u914d\u5217<\/td>\n<td>\u30c7\u30fc\u30bf\u306e\u5909\u63db<\/td>\n<\/tr>\n<tr>\n<td><code>\u9078\u629e\u3059\u308b<\/code><\/td>\n<td>\u4e00\u81f4\u3059\u308b\u8981\u7d20\u306e\u65b0\u3057\u3044\u914d\u5217<\/td>\n<td>\u30d5\u30a3\u30eb\u30bf\u30fc\u30c7\u30fc\u30bf<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><strong>Ruby\u5217\u6319\u53ef\u80fd\uff1a\u30d1\u30ef\u30fc\u306e\u9023\u9396<\/strong><\/h2>\n<p>\u8868\u73fe\u529b\u8c4a\u304b\u306a\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306e\u305f\u3081\u306e\u30c1\u30a7\u30fc\u30f3\u30e1\u30bd\u30c3\u30c9\uff1a<\/p>\n<pre>\u30eb\u30d3\u30fc\n(1..10)\n  .select(&amp;:even?) # [2, 4, 6, 8, 10].\n  .map { |n| n ** 2 }.   # [4, 16, 36, 64, 100] .each { |q| puts n ** 2 }.\n  .each { |sq| puts sq }.<\/pre>\n<p>\u5b9f\u4f8b\u3060\uff1a<\/p>\n<pre>\u30eb\u30d3\u30fc\nactive_emails = \u30e6\u30fc\u30b6\u30fc\n  .select { |u| u[:active] &amp;&amp; u[:age] &gt;= 18 }.\n  .\u30de\u30c3\u30d7 { |u| u[:email] }.<\/pre>\n<h2><strong>Ruby\u306e\u5217\u6319\u578b\uff1a\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u30d2\u30f3\u30c8<\/strong><\/h2>\n<h4><strong>1\u30d1\u30b9 &gt; 2\u30d1\u30b9<\/strong><\/h4>\n<pre>\u30eb\u30d3\u30fc\n# \u3088\u308a\u9045\u3044\uff1a2\u56de\u306e\u7e70\u308a\u8fd4\u3057\nusers.map(&amp;:age).select { |a| a &gt; 18 }.\n\n# \u3088\u308a\u9ad8\u901f\uff1a1\u56de\u306e\u7e70\u308a\u8fd4\u3057\nusers.select { |u| u[:age] &gt; 18 }.map(&amp;:age)<\/pre>\n<h4><strong>\u8a18\u53f7\u304b\u3089\u30d7\u30ed\u30c3\u30af\u3078\u306e\u901f\u8a18\u6cd5<\/strong><\/h4>\n<pre>\u30eb\u30d3\u30fc\nnames.map(&amp;:upcase)<\/pre>\n<h4><strong>\u5927\u898f\u6a21\uff0f\u7121\u9650\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u9045\u5ef6\u8a55\u4fa1<\/strong><\/h4>\n<pre>\u30eb\u30d3\u30fc\n(1..Float::INFINITY).lazy\n  .select(&amp;:even?)\n  .map { |n| n * n }.\n  .first(5)\n# =&gt; [4, 16, 36, 64, 100].<\/pre>\n<h3><strong>Ruby\u5217\u6319\u53ef\u80fd\uff1a\u30dc\u30fc\u30ca\u30b9\u30fb\u30d1\u30bf\u30fc\u30f3<\/strong><\/h3>\n<h4><strong>\u5b89\u5168\u306a\u69cb\u6587\u89e3\u6790 <\/strong><code>\u5730\u56f3<\/code><strong> + <\/strong><code>\u30b3\u30f3\u30d1\u30af\u30c8<\/code><\/h4>\n<pre>\u30eb\u30d3\u30fc\n[\"1\", \"2\", \"abc\"].map { |s| Integer(s) rescue nil }.compact\n# =&gt; [1, 2].<\/pre>\n<h4><strong>\u6700\u521d\u306e\u30de\u30c3\u30c1\u3092\u63a2\u3059<\/strong><\/h4>\n<pre>\u30eb\u30d3\u30fc\nadmin = users.find { |u| u[:role] == \"admin\" }.  # select.first\u3088\u308a\u826f\u3044<\/pre>\n<h4><strong>\u3067\u84c4\u7a4d\u3059\u308b <\/strong><code>each_with_\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/code><\/h4>\n<pre>\u30eb\u30d3\u30fc\n[1, 2, 3].each_with_object({}) { |n, h| h[n] = n * 2 }.\n# =&gt; {1=&gt;2, 2=&gt;4, 3=&gt;6}.<\/pre>\n<h2><strong>Ruby\u306e\u5217\u6319\u53ef\u80fd\uff1a\u6700\u7d42\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/strong><\/h2>\n<ul>\n<li>\u7528\u9014 <code>\u5404<\/code> \u2192 \u526f\u4f5c\u7528<\/li>\n<li>\u7528\u9014 <code>\u5730\u56f3<\/code> \u2192 \u5909\u63db<\/li>\n<li>\u7528\u9014 <code>\u9078\u629e\u3059\u308b<\/code> \u2192 \u30d5\u30a3\u30eb\u30bf\u30fc<\/li>\n<li>\u660e\u77ad\u3055\u306e\u305f\u3081\u306e\u30c1\u30a7\u30fc\u30f3<\/li>\n<li>\u623b\u308a\u5024\u3092\u7121\u8996\u3057\u306a\u3044<\/li>\n<li>\u597d\u3080 <code>\u63a2\u3059<\/code> \u30aa\u30fc\u30d0\u30fc <code>select.first<\/code><\/li>\n<li>\u7528\u9014 <code>\u3078\u305f\u308c<\/code> \u5de8\u5927\uff0f\u7121\u9650\u30b9\u30c8\u30ea\u30fc\u30e0\u7528<\/li>\n<\/ul>\n<h2><strong>\u7d50\u8ad6\uff1a<\/strong><\/h2>\n<p>Ruby\u306eEnumerable\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u5358\u306a\u308b\u30e1\u30bd\u30c3\u30c9\u96c6\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002Ruby\u306e <code>\u5404\u3001\u5730\u56f3<\/code>\u3001 \u305d\u3057\u3066 <code>\u9078\u629e\u3059\u308b<\/code>, \u305d\u3057\u3066\u3001\u6b21\u306e\u3088\u3046\u306a\u80fd\u529b\u304c\u8eab\u306b\u3064\u304f\uff1a<\/p>\n<ul>\n<li><strong>\u660e\u78ba\u306a\u610f\u601d\u8868\u793a<\/strong> - \u3082\u3046\u6df7\u4e71\u3059\u308b\u30eb\u30fc\u30d7\u306f\u306a\u3044\u3002.<\/li>\n<li><strong>\u30d0\u30b0\u3092\u907f\u3051\u308b<\/strong> - \u623b\u308a\u5024\u306f\u91cd\u8981\u3067\u3042\u308a\u3001\u3053\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u305d\u308c\u3092\u5f37\u5236\u3059\u308b\u3002.<\/li>\n<li><strong>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u304f<\/strong> - \u30ef\u30f3\u30d1\u30b9\u6f14\u7b97\u3068\u9045\u5ef6\u8a55\u4fa1\u3002.<\/li>\n<li><strong style=\"font-size: 16px;\">\u30c1\u30a7\u30fc\u30f3\u6d41\u66a2<\/strong><span style=\"font-size: 16px;\"> - \u5f37\u529b\u306a\u30c7\u30fc\u30bf\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u30921\u884c\u3067\u69cb\u7bc9\u3002.<\/span><\/li>\n<\/ul>\n<p>\u3067 <strong>\u30ec\u30fc\u30eb\u30ab\u30fc\u30de<\/strong>\u3092\u30ea\u30fc\u30c9\u3057\u3066\u3044\u308b\u3002 <a href=\"https:\/\/www.railscarma.com\/ja\">Ruby on Rails\u958b\u767a\u4f1a\u793e<\/a>, \u79c1\u305f\u3061\u306f\u3001\u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u3067\u4fdd\u5b88\u6027\u304c\u9ad8\u304f\u3001\u30a8\u30ec\u30ac\u30f3\u30c8\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b\u305f\u3081\u306b\u3001\u65e5\u3005\u3053\u308c\u3089\u306e\u539f\u5247\u3092\u9069\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u306e\u30d5\u30a3\u30eb\u30bf\u30ea\u30f3\u30b0\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u5909\u63db\u3001\u901a\u77e5\u306e\u9001\u4fe1\u306a\u3069\u3001\u5f53\u793e\u306e\u958b\u767a\u8005\u306fRuby\u306eEnumerable\uff08\u5217\u6319\u53ef\u80fd\uff09\u306a\u30d1\u30ef\u30fc\u3092\u6d3b\u7528\u3057\u3066\u3001\u8868\u73fe\u529b\u3068\u52b9\u7387\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u307e\u3059\u3002.<\/p>\n<p>\u3053\u308c\u3089\u306e\u65b9\u6cd5\u3092\u6bce\u65e5\u5b9f\u8df5\u3057\u3001\u8ce2\u304f\u9023\u9396\u3055\u305b\u308c\u3070\u3001\u3084\u304c\u3066\u3042\u306a\u305f\u306fRuby\u3092\u66f8\u304f\u3079\u304f\u3057\u3066\u66f8\u304b\u308c\u305f\u3088\u3046\u306b\u3001\u30a8\u30ec\u30ac\u30f3\u30c8\u3067\u3001\u8868\u73fe\u529b\u8c4a\u304b\u3067\u3001\u697d\u306b\u66f8\u3051\u308b\u3088\u3046\u306b\u306a\u308b\u3002.<\/p>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u304d\u3001irb\u3092\u8d77\u52d5\u3057\u3001\u4ee5\u4e0b\u3092\u8a66\u3057\u3066\u307f\u308b\u3002 <code>\u30de\u30c3\u30d7\u3092\u9078\u629e\u3059\u308b<\/code>\u3001 \u305d\u3057\u3066 <code>\u5404<\/code> \u3069\u3093\u306a\u30a2\u30ec\u30a4\u3067\u3082\u3002\u30d1\u30ef\u30fc\u306f\u3001\u305d\u3057\u3066RailsCarma\u306e\u3084\u308a\u65b9\u306f\u3001\u3042\u306a\u305f\u306e\u624b\u306e\u4e2d\u306b\u3042\u308a\u307e\u3059\u3002.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t  <div class=\"related-post slider\">\r\n        <div class=\"headline\">\u95a2\u9023\u8a18\u4e8b<\/div>\r\n    <div class=\"post-list owl-carousel\">\r\n\r\n            <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"What Does a Rails Upgrade Cost? Dependencies, Test Coverage and Deployment Risk\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/ruby-on-rails-upgrade-cost\/?related_post_from=41657\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Ruby-on-Rails-Upgrade-Cost.png\" class=\"attachment-full size-full wp-post-image\" alt=\"What Does a Rails Upgrade Cost? Dependencies, Test Coverage and Deployment Risk\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Ruby-on-Rails-Upgrade-Cost.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Ruby-on-Rails-Upgrade-Cost-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Ruby-on-Rails-Upgrade-Cost-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Ruby-on-Rails-Upgrade-Cost-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"What Does a Rails Upgrade Cost? Dependencies, Test Coverage and Deployment Risk\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/ruby-on-rails-upgrade-cost\/?related_post_from=41657\">\r\n        What Does a Rails Upgrade Cost? Dependencies, Test Coverage and Deployment Risk  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Rails Upgrade Testing: How to Reduce Release Risk When Test Coverage Is Limited\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/rails-upgrade-testing-limited-test-coverage\/?related_post_from=41651\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Rails-Upgrade-Testing.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Rails Upgrade Testing\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Rails-Upgrade-Testing.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Rails-Upgrade-Testing-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Rails-Upgrade-Testing-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Rails-Upgrade-Testing-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Rails Upgrade Testing: How to Reduce Release Risk When Test Coverage Is Limited\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/rails-upgrade-testing-limited-test-coverage\/?related_post_from=41651\">\r\n        Rails Upgrade Testing: How to Reduce Release Risk When Test Coverage Is Limited  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Multi-Vendor Marketplace Development with Ruby on Rails: A Complete Guide\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/multi-vendor-marketplace-development-with-ruby-on-rails\/?related_post_from=41636\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Multi-Vendor-Marketplace-Development-with-Ruby-on-Rails.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Multi-Vendor Marketplace Development with Ruby on Rails\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Multi-Vendor-Marketplace-Development-with-Ruby-on-Rails.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Multi-Vendor-Marketplace-Development-with-Ruby-on-Rails-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Multi-Vendor-Marketplace-Development-with-Ruby-on-Rails-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Multi-Vendor-Marketplace-Development-with-Ruby-on-Rails-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Multi-Vendor Marketplace Development with Ruby on Rails: A Complete Guide\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/multi-vendor-marketplace-development-with-ruby-on-rails\/?related_post_from=41636\">\r\n        Multi-Vendor Marketplace Development with Ruby on Rails: A Complete Guide  <\/a>\r\n\r\n        <\/div>\r\n              <div class=\"item\">\r\n            <div class=\"thumb post_thumb\">\r\n    <a  title=\"Medical App Development: A Practical Guide (2027)\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/what-is-medical-app-development\/?related_post_from=41618\">\r\n\r\n      <img decoding=\"async\" width=\"800\" height=\"300\" src=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Medical-App-Development.png\" class=\"attachment-full size-full wp-post-image\" alt=\"Medical App Development\" srcset=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Medical-App-Development.png 800w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Medical-App-Development-300x113.png 300w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Medical-App-Development-768x288.png 768w, https:\/\/www.railscarma.com\/wp-content\/uploads\/2026\/11\/Medical-App-Development-18x7.png 18w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\r\n\r\n    <\/a>\r\n  <\/div>\r\n\r\n  <a class=\"title post_title\"  title=\"Medical App Development: A Practical Guide (2027)\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/what-is-medical-app-development\/?related_post_from=41618\">\r\n        Medical App Development: A Practical Guide (2027)  <\/a>\r\n\r\n        <\/div>\r\n      \r\n  <\/div>\r\n\r\n  <script>\r\n      <\/script>\r\n  <style>\r\n    .related-post {}\r\n\r\n    .related-post .post-list {\r\n      text-align: left;\r\n          }\r\n\r\n    .related-post .post-list .item {\r\n      margin: 10px;\r\n      padding: 10px;\r\n          }\r\n\r\n    .related-post .headline {\r\n      font-size: 14px !important;\r\n      color: #999999 !important;\r\n          }\r\n\r\n    .related-post .post-list .item .post_thumb {\r\n      max-height: 220px;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n          }\r\n\r\n    .related-post .post-list .item .post_title {\r\n      font-size: 14px;\r\n      color: #000000;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .post-list .item .post_excerpt {\r\n      font-size: 12px;\r\n      color: #3f3f3f;\r\n      margin: 10px 0px;\r\n      padding: 0px;\r\n      display: block;\r\n      text-decoration: none;\r\n          }\r\n\r\n    .related-post .owl-dots .owl-dot {\r\n          }\r\n\r\n      <\/style>\r\n      <script>\r\n      jQuery(document).ready(function($) {\r\n        $(\".related-post .post-list\").owlCarousel({\r\n          items: 2,\r\n          responsiveClass: true,\r\n          responsive: {\r\n            0: {\r\n              items: 1,\r\n            },\r\n            768: {\r\n              items: 2,\r\n            },\r\n            1200: {\r\n              items: 2,\r\n            }\r\n          },\r\n                      rewind: true,\r\n                                loop: true,\r\n                                center: false,\r\n                                autoplay: true,\r\n            autoplayHoverPause: true,\r\n                                nav: true,\r\n            navSpeed: 1000,\r\n            navText: ['<i class=\"fas fa-chevron-left\"><\/i>', '<i class=\"fas fa-chevron-right\"><\/i>'],\r\n                                dots: false,\r\n            dotsSpeed: 1200,\r\n                                                    rtl: false,\r\n          \r\n        });\r\n      });\r\n    <\/script>\r\n  <\/div>","protected":false},"excerpt":{"rendered":"<p>Ruby\u2019s Ruby Enumerable module is the powerhouse behind expressive, functional-style iteration. Mixed into Array, Hash, Range, Set, and custom collections, it enables clean, efficient data processing.&nbsp;Enhance your Ruby projects with expert Rails consulting services, optimizing each, map, and select for cleaner, high-performance code. Ruby Enumerable: The Foundation To use Ruby Enumerable, a class must define each: ruby class ShoppingList include Enumerable def initialize(*items) &nbsp;&nbsp; @items = items end def each(&amp;block) &nbsp;&nbsp; @items.each(&amp;block) end end Now ShoppingList supports all Ruby Enumerable methods. Ruby Enumerable: each \u2013 Execute Per Item What each Does Runs a block for every element. Returns the original collection. ruby [1, 2, 3].each { |n| puts n * &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.railscarma.com\/ja\/%e3%83%96%e3%83%ad%e3%82%b0\/what-is-medical-app-development\/\"> <span class=\"screen-reader-text\">Medical App Development: A Practical Guide (2027)<\/span> \u3082\u3063\u3068\u8aad\u3080 \"<\/a><\/p>","protected":false},"author":11,"featured_media":40294,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1224],"tags":[],"class_list":["post-40261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Master Ruby Enumerable: each, map, and select - RailsCarma<\/title>\n<meta name=\"description\" content=\"Master Ruby Enumerable methods \u2014 each, map, and select \u2014 to write clean, efficient, and expressive Ruby code with better data handling.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.railscarma.com\/ja\/\u30d6\u30ed\u30b0\/\u30de\u30b9\u30bf\u30fc\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd\u306a\u5404\u30de\u30c3\u30d7\u3068\u9078\u629e\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Master Ruby Enumerable: each, map, and select - RailsCarma\" \/>\n<meta property=\"og:description\" content=\"Master Ruby Enumerable methods \u2014 each, map, and select \u2014 to write clean, efficient, and expressive Ruby code with better data handling.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.railscarma.com\/ja\/\u30d6\u30ed\u30b0\/\u30de\u30b9\u30bf\u30fc\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd\u306a\u5404\u30de\u30c3\u30d7\u3068\u9078\u629e\/\" \/>\n<meta property=\"og:site_name\" content=\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RailsCarma\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-03T06:35:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-03T06:41:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"ashish\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@railscarma\" \/>\n<meta name=\"twitter:site\" content=\"@railscarma\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ashish\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/\"},\"author\":{\"name\":\"ashish\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a\"},\"headline\":\"Master Ruby Enumerable: each, map, and select\",\"datePublished\":\"2025-11-03T06:35:32+00:00\",\"dateModified\":\"2025-11-03T06:41:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/\"},\"wordCount\":447,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png\",\"articleSection\":[\"Blogs\"],\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/\",\"url\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/\",\"name\":\"Master Ruby Enumerable: each, map, and select - RailsCarma\",\"isPartOf\":{\"@id\":\"https:\/\/www.railscarma.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png\",\"datePublished\":\"2025-11-03T06:35:32+00:00\",\"dateModified\":\"2025-11-03T06:41:24+00:00\",\"description\":\"Master Ruby Enumerable methods \u2014 each, map, and select \u2014 to write clean, efficient, and expressive Ruby code with better data handling.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png\",\"width\":800,\"height\":300,\"caption\":\"Ruby Enumerable each, map, and select\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.railscarma.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Master Ruby Enumerable: each, map, and select\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.railscarma.com\/#website\",\"url\":\"https:\/\/www.railscarma.com\/\",\"name\":\"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development\",\"description\":\"RailsCarma is a Ruby on Rails Development Company in Bangalore. We specialize in Offshore Ruby on Rails Development based out in USA and India. Hire experienced Ruby on Rails developers for the ultimate Web Experience.\",\"publisher\":{\"@id\":\"https:\/\/www.railscarma.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.railscarma.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.railscarma.com\/#organization\",\"name\":\"RailsCarma\",\"url\":\"https:\/\/www.railscarma.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"contentUrl\":\"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png\",\"width\":200,\"height\":46,\"caption\":\"RailsCarma\"},\"image\":{\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RailsCarma\/\",\"https:\/\/x.com\/railscarma\",\"https:\/\/www.linkedin.com\/company\/railscarma\/\",\"https:\/\/myspace.com\/railscarma\",\"https:\/\/in.pinterest.com\/railscarma\/\",\"https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a\",\"name\":\"ashish\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g\",\"caption\":\"ashish\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ruby\u306e\u5217\u6319\u578b\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3088\u3046\uff1aeach\u3001map\u3001select - RailsCarma","description":"Ruby\u306eEnumerable\u30e1\u30bd\u30c3\u30c9\uff08each\u3001map\u3001select\uff09\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3066\u3001\u3088\u308a\u826f\u3044\u30c7\u30fc\u30bf\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3067\u3001\u30af\u30ea\u30fc\u30f3\u3067\u52b9\u7387\u7684\u3001\u8868\u73fe\u529b\u8c4a\u304b\u306aRuby\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.railscarma.com\/ja\/\u30d6\u30ed\u30b0\/\u30de\u30b9\u30bf\u30fc\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd\u306a\u5404\u30de\u30c3\u30d7\u3068\u9078\u629e\/","og_locale":"ja_JP","og_type":"article","og_title":"Master Ruby Enumerable: each, map, and select - RailsCarma","og_description":"Master Ruby Enumerable methods \u2014 each, map, and select \u2014 to write clean, efficient, and expressive Ruby code with better data handling.","og_url":"https:\/\/www.railscarma.com\/ja\/\u30d6\u30ed\u30b0\/\u30de\u30b9\u30bf\u30fc\u30eb\u30d3\u30fc\u5217\u6319\u53ef\u80fd\u306a\u5404\u30de\u30c3\u30d7\u3068\u9078\u629e\/","og_site_name":"RailsCarma - Ruby on Rails Development Company specializing in Offshore Development","article_publisher":"https:\/\/www.facebook.com\/RailsCarma\/","article_published_time":"2025-11-03T06:35:32+00:00","article_modified_time":"2025-11-03T06:41:24+00:00","og_image":[{"width":800,"height":300,"url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png","type":"image\/png"}],"author":"ashish","twitter_card":"summary_large_image","twitter_creator":"@railscarma","twitter_site":"@railscarma","twitter_misc":{"\u57f7\u7b46\u8005":"ashish","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"3\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#article","isPartOf":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/"},"author":{"name":"ashish","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a"},"headline":"Master Ruby Enumerable: each, map, and select","datePublished":"2025-11-03T06:35:32+00:00","dateModified":"2025-11-03T06:41:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/"},"wordCount":447,"commentCount":0,"publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"image":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png","articleSection":["Blogs"],"inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/","url":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/","name":"Ruby\u306e\u5217\u6319\u578b\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3088\u3046\uff1aeach\u3001map\u3001select - RailsCarma","isPartOf":{"@id":"https:\/\/www.railscarma.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage"},"image":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage"},"thumbnailUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png","datePublished":"2025-11-03T06:35:32+00:00","dateModified":"2025-11-03T06:41:24+00:00","description":"Ruby\u306eEnumerable\u30e1\u30bd\u30c3\u30c9\uff08each\u3001map\u3001select\uff09\u3092\u30de\u30b9\u30bf\u30fc\u3057\u3066\u3001\u3088\u308a\u826f\u3044\u30c7\u30fc\u30bf\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3067\u3001\u30af\u30ea\u30fc\u30f3\u3067\u52b9\u7387\u7684\u3001\u8868\u73fe\u529b\u8c4a\u304b\u306aRuby\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002.","breadcrumb":{"@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#primaryimage","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2025\/11\/Master-Ruby-Enumerable-each-map-and-select.png","width":800,"height":300,"caption":"Ruby Enumerable each, map, and select"},{"@type":"BreadcrumbList","@id":"https:\/\/www.railscarma.com\/blog\/master-ruby-enumerable-each-map-and-select\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.railscarma.com\/"},{"@type":"ListItem","position":2,"name":"Master Ruby Enumerable: each, map, and select"}]},{"@type":"WebSite","@id":"https:\/\/www.railscarma.com\/#website","url":"https:\/\/www.railscarma.com\/","name":"RailsCarma - \u30aa\u30d5\u30b7\u30e7\u30a2\u958b\u767a\u306b\u7279\u5316\u3057\u305f Ruby on Rails \u958b\u767a\u4f1a\u793e","description":"RailsCarma \u306f\u30d0\u30f3\u30ac\u30ed\u30fc\u30eb\u306e Ruby on Rails \u958b\u767a\u4f1a\u793e\u3067\u3059\u3002\u5f53\u793e\u306f\u7c73\u56fd\u3068\u30a4\u30f3\u30c9\u3092\u62e0\u70b9\u3068\u3059\u308b\u30aa\u30d5\u30b7\u30e7\u30a2 Ruby on Rails \u958b\u767a\u3092\u5c02\u9580\u3068\u3057\u3066\u3044\u307e\u3059\u3002\u7d4c\u9a13\u8c4a\u5bcc\u306a Ruby on Rails \u958b\u767a\u8005\u3092\u96c7\u3063\u3066\u3001\u7a76\u6975\u306e Web \u30a8\u30af\u30b9\u30da\u30ea\u30a8\u30f3\u30b9\u3092\u5b9f\u73fe\u3057\u307e\u3057\u3087\u3046\u3002","publisher":{"@id":"https:\/\/www.railscarma.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.railscarma.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/www.railscarma.com\/#organization","name":"\u30ec\u30fc\u30eb\u30ab\u30fc\u30de","url":"https:\/\/www.railscarma.com\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","contentUrl":"https:\/\/www.railscarma.com\/wp-content\/uploads\/2020\/08\/railscarma_logo.png","width":200,"height":46,"caption":"RailsCarma"},"image":{"@id":"https:\/\/www.railscarma.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RailsCarma\/","https:\/\/x.com\/railscarma","https:\/\/www.linkedin.com\/company\/railscarma\/","https:\/\/myspace.com\/railscarma","https:\/\/in.pinterest.com\/railscarma\/","https:\/\/www.youtube.com\/channel\/UCx3Wil-aAnDARuatTEyMdpg"]},{"@type":"Person","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/9699b14852b308edfeb03096b33c7a7a","name":"\u30a2\u30b7\u30b7","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.railscarma.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/204411c7d72714bc32d5ac6398e0596896318386bd537860fdd14ce905a79e07?s=96&d=mm&r=g","caption":"ashish"}}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/posts\/40261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/comments?post=40261"}],"version-history":[{"count":0,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/posts\/40261\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/media\/40294"}],"wp:attachment":[{"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/media?parent=40261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/categories?post=40261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.railscarma.com\/ja\/wp-json\/wp\/v2\/tags?post=40261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}