Class: Pwrake::LifoQueueArray
- Inherits:
-
Array
- Object
- Array
- Pwrake::LifoQueueArray
- Defined in:
- lib/pwrake/queue/queue_array.rb
Instance Method Summary collapse
-
#initialize(n_cores = nil) ⇒ LifoQueueArray
constructor
A new instance of LifoQueueArray.
- #shift(host_info = nil) ⇒ Object
Constructor Details
#initialize(n_cores = nil) ⇒ LifoQueueArray
Returns a new instance of LifoQueueArray.
65 66 67 |
# File 'lib/pwrake/queue/queue_array.rb', line 65 def initialize(n_cores=nil) super() end |
Instance Method Details
#shift(host_info = nil) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/pwrake/queue/queue_array.rb', line 69 def shift(host_info=nil) return super() unless host_info i_tried = [] (size-1).downto(0) 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 |