Class: Resque::One::JobInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/resque/one/job_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, args) ⇒ JobInfo

Returns a new instance of JobInfo.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/resque/one/job_info.rb', line 11

def initialize(klass, args)
  @klass = klass.is_a?(Class) ? klass : Consty.get(klass)

  if include_plugin_status?
    @id = args.first
    @args = args[1..-1]
  else
    @id = nil
    @args = args
  end
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/resque/one/job_info.rb', line 5

def args
  @args
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/resque/one/job_info.rb', line 5

def id
  @id
end

#klassObject (readonly)

Returns the value of attribute klass.



5
6
7
# File 'lib/resque/one/job_info.rb', line 5

def klass
  @klass
end

Class Method Details

.parse(job_payload) ⇒ Object



7
8
9
# File 'lib/resque/one/job_info.rb', line 7

def self.parse(job_payload)
  new job_payload['class'], job_payload['args']
end

Instance Method Details

#keyObject



23
24
25
# File 'lib/resque/one/job_info.rb', line 23

def key
  @key ||= "#{klass.name}:#{args_digest}"
end

#one?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/resque/one/job_info.rb', line 27

def one?
  klass.respond_to?(:one?) ? klass.one? : false
end