Class: CI::Queue::Static
- Inherits:
-
Object
- Object
- CI::Queue::Static
- Defined in:
- lib/ci/queue/static.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #acknowledge(test) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(tests, max_requeues: 0, requeue_tolerance: 0.0) ⇒ Static
constructor
A new instance of Static.
- #poll ⇒ Object
- #requeue(test) ⇒ Object
- #size ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(tests, max_requeues: 0, requeue_tolerance: 0.0) ⇒ Static
Returns a new instance of Static.
6 7 8 9 10 11 12 |
# File 'lib/ci/queue/static.rb', line 6 def initialize(tests, max_requeues: 0, requeue_tolerance: 0.0) @queue = tests @progress = 0 @total = tests.size @max_requeues = max_requeues @global_max_requeues = (tests.size * requeue_tolerance).ceil end |
Instance Attribute Details
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
4 5 6 |
# File 'lib/ci/queue/static.rb', line 4 def progress @progress end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
4 5 6 |
# File 'lib/ci/queue/static.rb', line 4 def total @total end |
Instance Method Details
#acknowledge(test) ⇒ Object
33 34 35 |
# File 'lib/ci/queue/static.rb', line 33 def acknowledge(test) true end |
#empty? ⇒ Boolean
29 30 31 |
# File 'lib/ci/queue/static.rb', line 29 def empty? @queue.empty? end |
#poll ⇒ Object
22 23 24 25 26 27 |
# File 'lib/ci/queue/static.rb', line 22 def poll while test = @queue.shift yield test @progress += 1 end end |
#requeue(test) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/ci/queue/static.rb', line 37 def requeue(test) return false unless should_requeue?(test) requeues[test] += 1 @queue.unshift(test) true end |
#size ⇒ Object
18 19 20 |
# File 'lib/ci/queue/static.rb', line 18 def size @queue.size end |
#to_a ⇒ Object
14 15 16 |
# File 'lib/ci/queue/static.rb', line 14 def to_a @queue.dup end |