Sha256: 06895e81b71d8488ac4899d82024e9620d8ba67874688eb4a2c33b8438334c24

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

module EMJack
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-beanstalk-0.0.3 lib/em-jack/job.rb