Class: EM::Beanstalk::Job
- Inherits:
-
Object
- Object
- EM::Beanstalk::Job
- Defined in:
- lib/em-beanstalk/job.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#delay ⇒ Object
Returns the value of attribute delay.
-
#id ⇒ Object
(also: #jobid)
readonly
Returns the value of attribute id.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#ttr ⇒ Object
Returns the value of attribute ttr.
Instance Method Summary collapse
- #delete(&block) ⇒ Object
-
#initialize(conn, id, body) ⇒ Job
constructor
A new instance of Job.
- #release(delay = 0, &block) ⇒ Object
- #stats(&block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(conn, id, body) ⇒ Job
Returns a new instance of Job.
8 9 10 11 12 13 14 15 |
# File 'lib/em-beanstalk/job.rb', line 8 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 |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/em-beanstalk/job.rb', line 6 def body @body end |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
5 6 7 |
# File 'lib/em-beanstalk/job.rb', line 5 def conn @conn end |
#delay ⇒ Object
Returns the value of attribute delay.
6 7 8 |
# File 'lib/em-beanstalk/job.rb', line 6 def delay @delay end |
#id ⇒ Object (readonly) Also known as: jobid
Returns the value of attribute id.
5 6 7 |
# File 'lib/em-beanstalk/job.rb', line 5 def id @id end |
#priority ⇒ Object
Returns the value of attribute priority.
6 7 8 |
# File 'lib/em-beanstalk/job.rb', line 6 def priority @priority end |
#ttr ⇒ Object
Returns the value of attribute ttr.
6 7 8 |
# File 'lib/em-beanstalk/job.rb', line 6 def ttr @ttr end |
Instance Method Details
#delete(&block) ⇒ Object
19 20 21 |
# File 'lib/em-beanstalk/job.rb', line 19 def delete(&block) conn.delete(self, &block) end |
#release(delay = 0, &block) ⇒ Object
23 24 25 |
# File 'lib/em-beanstalk/job.rb', line 23 def release(delay = 0, &block) conn.release(self, :delay => delay, :priority => priority, &block) end |
#stats(&block) ⇒ Object
27 28 29 |
# File 'lib/em-beanstalk/job.rb', line 27 def stats(&block) conn.stats(:job, self, &block) end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/em-beanstalk/job.rb', line 31 def to_s "#{id} -- #{body.inspect}" end |