Writing a method that returns at some point and can resume later to return a new value is possible when using the Fiber class.
This entry presents the Fiber class by implementing a tokenizer (a tokenizer analyzes an input stream, searches for sequences that matches some patterns and produces tokens).
Read the full entry at http://www.alef1.org/articles/2012/ruby_and_fiber.html.
Note: The article was first published on October 14, 2012
No comments:
Post a Comment