Sha256: 780b207107bec2c235518c22fe80bbaa9b5c3edad5351f895f5c1b7fa9c835db

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

module Backburner
  module Queue
    def self.included(base)
      base.send(:extend, Backburner::Helpers)
      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 || dasherize(self.name)
        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 # Job
end # Backburner

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backburner-0.1.2 lib/backburner/queue.rb
backburner-0.1.1 lib/backburner/queue.rb
backburner-0.1.0 lib/backburner/queue.rb
backburner-0.0.3 lib/backburner/queue.rb