Class: KnapsackPro::Queue

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/knapsack_pro/queue.rb

Instance Method Summary collapse

Constructor Details

#initializeQueue

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_batchObject



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_failedObject



24
25
26
# File 'lib/knapsack_pro/queue.rb', line 24

def mark_batch_failed
  current_batch._failed
end

#mark_batch_passedObject



20
21
22
# File 'lib/knapsack_pro/queue.rb', line 20

def mark_batch_passed
  current_batch._passed
end

#sizeObject



32
33
34
# File 'lib/knapsack_pro/queue.rb', line 32

def size
  @batches.size
end