Class: Resque::One::JobInfo
- Inherits:
-
Object
- Object
- Resque::One::JobInfo
- Defined in:
- lib/resque/one/job_info.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(klass, args) ⇒ JobInfo
constructor
A new instance of JobInfo.
- #key ⇒ Object
- #one? ⇒ Boolean
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
#args ⇒ Object (readonly)
Returns the value of attribute args.
5 6 7 |
# File 'lib/resque/one/job_info.rb', line 5 def args @args end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/resque/one/job_info.rb', line 5 def id @id end |
#klass ⇒ Object (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
#key ⇒ Object
23 24 25 |
# File 'lib/resque/one/job_info.rb', line 23 def key @key ||= "#{klass.name}:#{args_digest}" end |
#one? ⇒ Boolean
27 28 29 |
# File 'lib/resque/one/job_info.rb', line 27 def one? klass.respond_to?(:one?) ? klass.one? : false end |