class MockBeaneater::Job

Attributes

body[R]
connection[R]
id[R]
pri[R]
reserved[R]
tube[R]
visible_at[R]

Public Class Methods

new(body, tube, visible_at = Time.now.to_i, pri = 65536) click to toggle source
# File lib/mock_beaneater/job/record.rb, line 5
def initialize(body, tube, visible_at = Time.now.to_i, pri = 65536)
  @id = (Jobs.count += 1)
  @body = body
  @tube = tube
  @visible_at = visible_at
  @pri = pri
  @reserved = false
end

Public Instance Methods

==(other_job) click to toggle source
# File lib/mock_beaneater/job/record.rb, line 32
def ==(other_job)
  @id == other_job.id
end
delete() click to toggle source
# File lib/mock_beaneater/job/record.rb, line 21
def delete
  @reserved = false
  @tube.delete(self)
  {:status => "DELETED",
   :body => nil}
end
release(options={}) click to toggle source
# File lib/mock_beaneater/job/record.rb, line 14
def release(options={})
  @reserved = false
  @tube.release(self)
  {:status => "RELEASED",
   :body => nil}
end
reserved?() click to toggle source
# File lib/mock_beaneater/job/record.rb, line 28
def reserved?
  @reserved
end
to_s() click to toggle source
# File lib/mock_beaneater/job/record.rb, line 36
def to_s
  "#<MockBeaneater::Job id=#{@id} body=#{@body.inspect}>"
end