class Enparallel::Picker

Public Class Methods

new(items, rule) click to toggle source
# File lib/enparallel/picker.rb, line 3
def initialize(items, rule)
    if rule == :random
        items = items.shuffle
    end

    @items = items
    @i = -1
end

Public Instance Methods

next() click to toggle source
# File lib/enparallel/picker.rb, line 12
def next
    @items[next_index]
end
next_index() click to toggle source
# File lib/enparallel/picker.rb, line 16
def next_index
    @i += 1
end