Class: TestQueue::Runner::TestUnit::IteratorWrapper
- Inherits:
-
Object
- Object
- TestQueue::Runner::TestUnit::IteratorWrapper
- Defined in:
- lib/test_queue/runner/testunit.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(iterator) ⇒ IteratorWrapper
constructor
A new instance of IteratorWrapper.
- #shift ⇒ Object
Constructor Details
#initialize(iterator) ⇒ IteratorWrapper
Returns a new instance of IteratorWrapper.
32 33 34 35 36 37 38 |
# File 'lib/test_queue/runner/testunit.rb', line 32 def initialize(iterator) @generator = Fiber.new do iterator.each do |test| Fiber.yield(test) end end end |
Instance Method Details
#each ⇒ Object
46 47 48 49 50 |
# File 'lib/test_queue/runner/testunit.rb', line 46 def each while (test = shift) yield(test) end end |
#shift ⇒ Object
40 41 42 43 44 |
# File 'lib/test_queue/runner/testunit.rb', line 40 def shift @generator.resume rescue FiberError nil end |