Fibers Are the Right Solution

https://www.codeotaku.com/journal/2018-11/fibers-are-the-right-solution/index
Good description of how to use fibers in ruby.