Sha256: bc19ba743e19f11dbd0b3d56187e47186d85432d252d2c75dd7aa3c75c3e60e4

Contents?: true

Size: 486 Bytes

Versions: 8

Compression:

Stored size: 486 Bytes

Contents

# Encoding: utf-8

module Qless
  module JobReservers
    class Ordered
      attr_reader :queues

      def initialize(queues)
        @queues = queues
      end

      def reserve
        @queues.each do |q|
          job = q.pop
          return job if job
        end
        nil
      end

      def prep_for_work!
        # nothing here on purpose
      end

      def description
        @description ||= @queues.map(&:name).join(', ') + ' (ordered)'
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
qless-0.12.0 lib/qless/job_reservers/ordered.rb
qless-0.11.0 lib/qless/job_reservers/ordered.rb
qless-0.10.5 lib/qless/job_reservers/ordered.rb
qless-0.10.4 lib/qless/job_reservers/ordered.rb
qless-0.10.3 lib/qless/job_reservers/ordered.rb
qless-0.10.2 lib/qless/job_reservers/ordered.rb
qless-0.10.1 lib/qless/job_reservers/ordered.rb
qless-0.10.0 lib/qless/job_reservers/ordered.rb