Class: Qless::BaseJob

Inherits:
Object
  • Object
show all
Defined in:
lib/qless/job.rb

Overview

The base for both Job and RecurringJob

Direct Known Subclasses

Job, RecurringJob

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, jid) ⇒ BaseJob

Returns a new instance of BaseJob.



14
15
16
17
# File 'lib/qless/job.rb', line 14

def initialize(client, jid)
  @client = client
  @jid    = jid
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



12
13
14
# File 'lib/qless/job.rb', line 12

def client
  @client
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



29
30
31
32
33
# File 'lib/qless/job.rb', line 29

def ==(other)
  self.class == other.class &&
  jid == other.jid &&
  client == other.client
end

#hashObject



36
37
38
# File 'lib/qless/job.rb', line 36

def hash
  self.class.hash ^ jid.hash ^ client.hash
end

#klassObject



19
20
21
22
23
# File 'lib/qless/job.rb', line 19

def klass
  @klass ||= @klass_name.split('::').reduce(Object) do |context, name|
    context.const_get(name)
  end
end

#queueObject



25
26
27
# File 'lib/qless/job.rb', line 25

def queue
  @queue ||= Queue.new(@queue_name, @client)
end