Class: Resque::Task
- Inherits:
-
Object
- Object
- Resque::Task
- Defined in:
- lib/resque/task.rb,
lib/resque/task/version.rb
Constant Summary collapse
- VERSION =
"0.0.3"
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#backtrace ⇒ Object
Returns the value of attribute backtrace.
-
#error ⇒ Object
Returns the value of attribute error.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#failed_at ⇒ Object
Returns the value of attribute failed_at.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#retried_at ⇒ Object
Returns the value of attribute retried_at.
-
#run_at ⇒ Object
Returns the value of attribute run_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#worker ⇒ Object
Returns the value of attribute worker.
Class Method Summary collapse
- .all ⇒ Object
- .failed(finish = 10000) ⇒ Object
- .queued(finish = 10000) ⇒ Object
- .working(finish = 10000) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}, status) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(options = {}, status) ⇒ Task
Returns a new instance of Task.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/resque/task.rb', line 10 def initialize(={}, status) ['parent'] = .delete('class') .each do |opt, val| self.send("#{opt}=", val) end if payload self.parent = payload['class'] self.args = payload['args'] end self.status = status end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/resque/task.rb', line 6 def args @args end |
#backtrace ⇒ Object
Returns the value of attribute backtrace.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def backtrace @backtrace end |
#error ⇒ Object
Returns the value of attribute error.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def error @error end |
#exception ⇒ Object
Returns the value of attribute exception.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def exception @exception end |
#failed_at ⇒ Object
Returns the value of attribute failed_at.
8 9 10 |
# File 'lib/resque/task.rb', line 8 def failed_at @failed_at end |
#parent ⇒ Object
Returns the value of attribute parent.
6 7 8 |
# File 'lib/resque/task.rb', line 6 def parent @parent end |
#payload ⇒ Object
Returns the value of attribute payload.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def payload @payload end |
#queue ⇒ Object
Returns the value of attribute queue.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def queue @queue end |
#retried_at ⇒ Object
Returns the value of attribute retried_at.
8 9 10 |
# File 'lib/resque/task.rb', line 8 def retried_at @retried_at end |
#run_at ⇒ Object
Returns the value of attribute run_at.
8 9 10 |
# File 'lib/resque/task.rb', line 8 def run_at @run_at end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/resque/task.rb', line 6 def status @status end |
#worker ⇒ Object
Returns the value of attribute worker.
7 8 9 |
# File 'lib/resque/task.rb', line 7 def worker @worker end |
Class Method Details
.all ⇒ Object
40 41 42 |
# File 'lib/resque/task.rb', line 40 def all [working, queued, failed].flatten end |
.failed(finish = 10000) ⇒ Object
28 29 30 |
# File 'lib/resque/task.rb', line 28 def failed(finish=10000) Resque::Failure.all(0, finish).map {|failure| Resque::Task.new(failure, :failed) } end |