Class: EMJack::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/em-jack/job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn, jobid, body) ⇒ Job

Returns a new instance of Job.



5
6
7
8
9
# File 'lib/em-jack/job.rb', line 5

def initialize(conn, jobid, body)
  @conn = conn
  @jobid = jobid.to_i
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



3
4
5
# File 'lib/em-jack/job.rb', line 3

def body
  @body
end

#connObject

Returns the value of attribute conn.



3
4
5
# File 'lib/em-jack/job.rb', line 3

def conn
  @conn
end

#jobidObject

Returns the value of attribute jobid.



3
4
5
# File 'lib/em-jack/job.rb', line 3

def jobid
  @jobid
end

#ttrObject

Returns the value of attribute ttr.



3
4
5
# File 'lib/em-jack/job.rb', line 3

def ttr
  @ttr
end

Instance Method Details

#bury(delay, &blk) ⇒ Object



27
28
29
# File 'lib/em-jack/job.rb', line 27

def bury(delay, &blk)
  @conn.bury(self, delay, &blk)
end

#delete(&blk) ⇒ Object



11
12
13
# File 'lib/em-jack/job.rb', line 11

def delete(&blk)
  @conn.delete(self, &blk)
end

#release(opts = {}, &blk) ⇒ Object



15
16
17
# File 'lib/em-jack/job.rb', line 15

def release(opts = {}, &blk)
  @conn.release(self, opts, &blk)
end

#stats(&blk) ⇒ Object



19
20
21
# File 'lib/em-jack/job.rb', line 19

def stats(&blk)
  @conn.stats(:job, self, &blk)
end

#to_sObject



31
32
33
# File 'lib/em-jack/job.rb', line 31

def to_s
  "#{@jobid} -- #{body.inspect}"
end

#touch(&blk) ⇒ Object



23
24
25
# File 'lib/em-jack/job.rb', line 23

def touch(&blk)
  @conn.touch(self, &blk)
end