Rubyã®ã¹ã¬ããã¯ç´ æ´ãããã¨æãã®ã§ããããªãã人æ°ãããã¾ããã Fiberã§æ¸ãã°äººæ°ãåºãã¨æãã®ã§ãã¨ãã©ã調ã¹ã¦ãã¾ããå¤ãã®ãµã³ãã«ã¯æ¬¡ã®ãããªã¸ã§ãã¬ã¼ã¿ã¼ã£ã½ããã®ã§ãã 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ãªã©ã®å®è£ ããããªæãã§ã§ãã¦ããã§ããããã äºã¤ã®å®è¡ä¸»ä½ï¼fibã®Fiberã¨10.times..ãã¦ãã¡ã¤ã³é¨åï¼ã¯ã¡ã¤ã³é¨åãFiberãå©ç¨ãã¦ãããããªæ§å³ã§ãï¼ï¼ï¼ï¼ã resumeããã¹ãç¸æã®ãã¨ãç¥ã£ã¦ããããããFiberãè³æºã¿ãããªæãï¼ï¼ï¼ï¼ï¼ã ãã«ãã¹ã¬ããã§ã®ããã°ã©ãã³ã°ã®ããã«ãè¤æ°ã®Fiberéã§é£æºããé°
{{#tags}}- {{label}}
{{/tags}}