How would I run two loop do ... end
simultaneously in Ruby? One would be for CLI interface and the other would开发者_如何转开发 be for background processing.
Sounds like you want two threads.
You can use yield to create co-routines
Generators like Ruby's can be 'abused' to create coroutines. I don't speak Ruby but I could outline the concept in C# or Python.
It also appears like something was added in Ruby 1.9 to make this easier
Cheers
精彩评论