Sha256: bb489368af2b616556521f051fe927d02404629300ba5656816cf0355ebc3359

Contents?: true

Size: 887 Bytes

Versions: 4

Compression:

Stored size: 887 Bytes

Contents

module Backburner
  module Queue
    def self.included(base)
      base.extend ClassMethods
      Backburner::Worker.known_queue_classes << base
    end

    module ClassMethods
      # Returns or assigns queue name for this job.
      #
      # @example
      #   queue "some.task.name"
      #   @klass.queue # => "some.task.name"
      #
      def queue(name=nil)
        if name
          @queue_name = name
        else # accessor
          @queue_name || Backburner.configuration.primary_queue
        end
      end

      # Returns or assigns queue priority for this job
      #
      # @example
      #   queue_priority 120
      #   @klass.queue_priority # => 120
      #
      def queue_priority(pri=nil)
        if pri
          @queue_priority = pri
        else # accessor
          @queue_priority
        end
      end
    end # ClassMethods
  end # Queue
end # Backburner

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backburner-0.4.3 lib/backburner/queue.rb
backburner-0.4.2 lib/backburner/queue.rb
backburner-0.4.1 lib/backburner/queue.rb
backburner-0.4.0 lib/backburner/queue.rb