Sha256: dc4dd56b44fefc5a71c96afbb7c02a030ba43a90e642f02438131207de9c339d
Contents?: true
Size: 394 Bytes
Versions: 12
Compression:
Stored size: 394 Bytes
Contents
module Unipept class BatchOrder attr_reader :order def initialize @order = {} @current = 0 end # Executes block if it's its turn, queues the block in the other case. def wait(i, &block) @order[i] = block return unless i == @current while order[@current] order.delete(@current).call @current += 1 end end end end
Version data entries
12 entries across 12 versions & 1 rubygems