Sha256: 0b3dab7eb08d862c7ea4d88422b0e4335b674de68802604c6aa66d2ffd9fb41b

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 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 release(delay = 0, &block)
        conn.release(self, :delay => delay, :priority => priority, &block)
      end
    
      def stats(&block)
        conn.stats(:job, self, &block)
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-beanstalk-0.0.10 lib/em-beanstalk/job.rb