Class: Pwrake::FifoQueueArray
- Inherits:
-
Array
- Object
- Array
- Pwrake::FifoQueueArray
- Defined in:
- lib/pwrake/queue/queue_array.rb
Instance Method Summary collapse
-
#initialize(n_cores = nil) ⇒ FifoQueueArray
constructor
A new instance of FifoQueueArray.
- #shift(host_info = nil) ⇒ Object
Constructor Details
#initialize(n_cores = nil) ⇒ FifoQueueArray
Returns a new instance of FifoQueueArray.
91 92 93 |
# File 'lib/pwrake/queue/queue_array.rb', line 91 def initialize(n_cores=nil) super() end |
Instance Method Details
#shift(host_info = nil) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/pwrake/queue/queue_array.rb', line 95 def shift(host_info=nil) return super() unless host_info i_tried = [] size.times do |i| tw = at(i) if tw.tried_host?(host_info) i_tried << i elsif tw.acceptable_for(host_info) return delete_at(i) end end i_tried.each do |i| tw = at(i) if tw.acceptable_for(host_info) return delete_at(i) end end nil end |