{"author_name":"obelisk2","blog_title":"Camera Obscura","type":"rich","image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2025%2F04%2F09%2F132010\" title=\"Ruby\u306eProc\u306f\u300c\u95a2\u6570\u300d\u3068\u3057\u3066\u30d6\u30ed\u30c3\u30af\u3092\u53d6\u308c\u308b\u304b\uff1f - Camera Obscura\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"\u7d50\u8ad6\u3002\u9a5a\u304f\u3079\u304d\u3053\u3068\u306b\u3001Proc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u300c\u95a2\u6570\u300d\u3068\u898b\u505a\u3057\u3066\u30d6\u30ed\u30c3\u30af\u3092\u53d6\u308b\u3088\u3046\u306a\u4f7f\u3044\u65b9\u304c\u3067\u304d\u308b\u3002 foo = ->(&bk){ bk.call.upcase } puts foo.() { \"nyao\" } #=>NYAO \u3055\u3089\u306b\u3001enum_for\u3084to_enum\u3092\u4f7f\u3063\u3066\u30e1\u30bd\u30c3\u30c9\u3092 Enumerator\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u30d6\u30ed\u30c3\u30af\u3092\u53d6\u308b Proc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3082Enumerator::Yielder#to_proc\u3092\u4f7f\u3063\u3066 Enumerator\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002 def foo (1..10).each { yield(_1) } end enum_for(:foo).map { _1\u2026","width":"100%","provider_name":"Hatena Blog","height":"190","provider_url":"https://hatena.blog","blog_url":"https://obelisk.hatenablog.com/","version":"1.0","categories":["Ruby"],"title":"Ruby\u306eProc\u306f\u300c\u95a2\u6570\u300d\u3068\u3057\u3066\u30d6\u30ed\u30c3\u30af\u3092\u53d6\u308c\u308b\u304b\uff1f","published":"2025-04-09 13:20:10","url":"https://obelisk.hatenablog.com/entry/2025/04/09/132010","author_url":"https://blog.hatena.ne.jp/obelisk2/"}