{"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdruby.hatenablog.com%2Fentry%2F2017%2F05%2F14%2F092137\" title=\"Fiber\u306e\u305f\u3081\u306e\u540c\u671f\u6a5f\u69cb\u306e\u4f5c\u308a\u65b9 - @m_seki \u306e\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"@m_seki \u306e","author_name":"m_seki","height":"190","provider_url":"https://hatena.blog","width":"100%","type":"rich","blog_url":"https://druby.hatenablog.com/","title":"Fiber\u306e\u305f\u3081\u306e\u540c\u671f\u6a5f\u69cb\u306e\u4f5c\u308a\u65b9","description":"Ruby\u306e\u30b9\u30ec\u30c3\u30c9\u306f\u7d20\u6674\u3089\u3057\u3044\u3068\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u306a\u305c\u304b\u4eba\u6c17\u304c\u3042\u308a\u307e\u305b\u3093\u3002Fiber\u3067\u66f8\u3051\u3070\u4eba\u6c17\u304c\u51fa\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u3068\u304d\u3069\u304d\u8abf\u3079\u3066\u3044\u307e\u3059\u3002\u591a\u304f\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u6b21\u306e\u3088\u3046\u306a\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u3063\u307d\u3044\u3082\u306e\u3067\u3059\u3002 fib = Fiber.new do a, b = 1, 1 while true Fiber.yield(a) a, b = b, a + b end end 10.times do |n| p [n, fib.resume] end Enumerator\u306a\u3069\u306e\u5b9f\u88c5\u3082\u3053\u3093\u306a\u611f\u3058\u3067\u3067\u304d\u3066\u308b\u3093\u3067\u3057\u3087\u3046\u306d\u3002 \u4e8c\u3064\u306e\u5b9f\u884c\u4e3b\u4f53\uff08fib\u306eFiber\u306810.times..\u3057\u3066\u308b\u30e1\u30a4\u30f3\u90e8\u5206\uff09\u306f\u30e1\u30a4\u30f3\u90e8\u5206\u304cFiber\u3092\u5229\u7528\u2026","url":"https://druby.hatenablog.com/entry/2017/05/14/092137","version":"1.0","provider_name":"Hatena Blog","image_url":"https://images-fe.ssl-images-amazon.com/images/I/51K0jUf%2BiEL._SL75_.jpg","author_url":"https://blog.hatena.ne.jp/m_seki/","categories":[],"published":"2017-05-14 09:21:37"}