Sha256: aa94f861a01ab73b5f57ad372414cdde2a2f2189502a8f720863645b0853125a

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

module EM
  class Beanstalk
    class Job
    
      attr_reader :id, :conn
      attr_accessor :body, :ttr, :priority, :delay
    
      def initialize(conn, id, body)
        @conn = conn
        @id = id && Integer(id)
        @body = body
        @priority = conn && conn.default_priority
        @delay = conn && conn.default_delay
        @ttr = conn && conn.default_ttr
      end
    
      alias_method :jobid, :id
    
      def delete(&block)
        conn.delete(self, &block)
      end
    
      def stats(&block)
        conn.stats(:job, self, &block)
      end

      def to_s
        "#{id} -- #{body.inspect}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-beanstalk-0.0.5 lib/em-beanstalk/job.rb
em-beanstalk-0.0.4 lib/em-beanstalk/job.rb