Class: Mutant::Parallel::Source::Array Private
- Inherits:
-
Object
- Object
- Mutant::Parallel::Source::Array
- Defined in:
- lib/mutant/parallel/source.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Job source backed by a finite array
Instance Method Summary collapse
-
#initialize ⇒ undefined
constructor
private
Initialize objecto.
-
#next ⇒ Object
private
Next job.
-
#next? ⇒ Boolean
private
Test if next job is available.
Constructor Details
#initialize ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize objecto
31 32 33 34 35 |
# File 'lib/mutant/parallel/source.rb', line 31 def initialize(*) super @next_index = 0 end |
Instance Method Details
#next ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Next job
50 51 52 53 54 55 |
# File 'lib/mutant/parallel/source.rb', line 50 def next fail NoJobError unless next? jobs.fetch(@next_index).tap do @next_index += 1 end end |
#next? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if next job is available
40 41 42 |
# File 'lib/mutant/parallel/source.rb', line 40 def next? @next_index < jobs.length end |