Class: KnapsackPro::Queue
- Inherits:
-
Object
- Object
- KnapsackPro::Queue
- Includes:
- Enumerable
- Defined in:
- lib/knapsack_pro/queue.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
- #add_batch_for(test_file_paths) ⇒ Object
- #current_batch ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ Queue
constructor
A new instance of Queue.
- #mark_batch_failed ⇒ Object
- #mark_batch_passed ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ Queue
Returns a new instance of Queue.
7 8 9 |
# File 'lib/knapsack_pro/queue.rb', line 7 def initialize @batches = [] end |
Instance Method Details
#[](index) ⇒ Object
36 37 38 |
# File 'lib/knapsack_pro/queue.rb', line 36 def [](index) @batches[index] end |
#add_batch_for(test_file_paths) ⇒ Object
15 16 17 18 |
# File 'lib/knapsack_pro/queue.rb', line 15 def add_batch_for(test_file_paths) return if test_file_paths.empty? @batches << KnapsackPro::Batch.new(test_file_paths) end |
#current_batch ⇒ Object
28 29 30 |
# File 'lib/knapsack_pro/queue.rb', line 28 def current_batch @batches.last end |
#each(&block) ⇒ Object
11 12 13 |
# File 'lib/knapsack_pro/queue.rb', line 11 def each(&block) @batches.each(&block) end |
#mark_batch_failed ⇒ Object
24 25 26 |
# File 'lib/knapsack_pro/queue.rb', line 24 def mark_batch_failed current_batch._failed end |
#mark_batch_passed ⇒ Object
20 21 22 |
# File 'lib/knapsack_pro/queue.rb', line 20 def mark_batch_passed current_batch._passed end |
#size ⇒ Object
32 33 34 |
# File 'lib/knapsack_pro/queue.rb', line 32 def size @batches.size end |