A simple round-robin scheduling implementation used at various places in Dynflow
the `add` and `delete` methods should be preferred, but sometimes the list of things to iterate though can not be owned by the round robin object itself
# File lib/dynflow/round_robin.rb, line 5 def initialize @data = [] @cursor = 0 end
# File lib/dynflow/round_robin.rb, line 10 def add(item) @data.push item self end
# File lib/dynflow/round_robin.rb, line 15 def delete(item) @data.delete item self end
# File lib/dynflow/round_robin.rb, line 27 def empty? @data.empty? end
# File lib/dynflow/round_robin.rb, line 20 def next @cursor = 0 if @cursor > @data.size-1 @data[@cursor] ensure @cursor += 1 end