Class: Delayed::Web::Job::Double
- Inherits:
-
Object
- Object
- Delayed::Web::Job::Double
- Defined in:
- app/models/delayed/web/job/double.rb
Instance Attribute Summary collapse
-
#attempts ⇒ Object
Returns the value of attribute attempts.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#failed_at ⇒ Object
Returns the value of attribute failed_at.
-
#handler ⇒ Object
Returns the value of attribute handler.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_error ⇒ Object
Returns the value of attribute last_error.
-
#locked_at ⇒ Object
Returns the value of attribute locked_at.
-
#locked_by ⇒ Object
Returns the value of attribute locked_by.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#run_at ⇒ Object
Returns the value of attribute run_at.
Class Method Summary collapse
- .all ⇒ Object
- .build_executing ⇒ Object
- .build_failed ⇒ Object
- .build_queued ⇒ Object
- .decorate(job) ⇒ Object
- .find(*args) ⇒ Object
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ Double
constructor
A new instance of Double.
- #queue! ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Double
Returns a new instance of Double.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/delayed/web/job/double.rb', line 15 def initialize attributes = {} @id = attributes[:id] @created_at = attributes[:created_at] @run_at = attributes[:run_at] @queue = attributes[:queue] @attempts = attributes[:attempts] @failed_at = attributes[:failed_at] @locked_at = attributes[:locked_at] @locked_by = attributes[:locked_by] @last_error = attributes[:last_error] @handler = attributes[:handler] end |
Instance Attribute Details
#attempts ⇒ Object
Returns the value of attribute attempts.
8 9 10 |
# File 'app/models/delayed/web/job/double.rb', line 8 def attempts @attempts end |
#created_at ⇒ Object
Returns the value of attribute created_at.
5 6 7 |
# File 'app/models/delayed/web/job/double.rb', line 5 def created_at @created_at end |
#failed_at ⇒ Object
Returns the value of attribute failed_at.
9 10 11 |
# File 'app/models/delayed/web/job/double.rb', line 9 def failed_at @failed_at end |
#handler ⇒ Object
Returns the value of attribute handler.
13 14 15 |
# File 'app/models/delayed/web/job/double.rb', line 13 def handler @handler end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'app/models/delayed/web/job/double.rb', line 4 def id @id end |
#last_error ⇒ Object
Returns the value of attribute last_error.
12 13 14 |
# File 'app/models/delayed/web/job/double.rb', line 12 def last_error @last_error end |
#locked_at ⇒ Object
Returns the value of attribute locked_at.
10 11 12 |
# File 'app/models/delayed/web/job/double.rb', line 10 def locked_at @locked_at end |
#locked_by ⇒ Object
Returns the value of attribute locked_by.
11 12 13 |
# File 'app/models/delayed/web/job/double.rb', line 11 def locked_by @locked_by end |
#queue ⇒ Object
Returns the value of attribute queue.
7 8 9 |
# File 'app/models/delayed/web/job/double.rb', line 7 def queue @queue end |
#run_at ⇒ Object
Returns the value of attribute run_at.
6 7 8 |
# File 'app/models/delayed/web/job/double.rb', line 6 def run_at @run_at end |
Class Method Details
.all ⇒ Object
44 45 46 47 48 |
# File 'app/models/delayed/web/job/double.rb', line 44 def self.all [build_executing, build_failed, build_queued].map do |job| decorate job end end |
.build_executing ⇒ Object
54 55 56 57 58 |
# File 'app/models/delayed/web/job/double.rb', line 54 def self.build_executing new id: 1, created_at: 1.minute.ago, run_at: 1.minute.ago, attempts: 1, last_error: nil, locked_at: 30.seconds.ago, locked_by: 'host.local', handler: '---' end |
.build_failed ⇒ Object
60 61 62 63 64 |
# File 'app/models/delayed/web/job/double.rb', line 60 def self.build_failed new id: 2, created_at: 5.hours.ago, run_at: 2.hours.from_now, attempts: 4, failed_at: 1.hour.ago, last_error: 'RuntimeError: RuntimeError', locked_at: nil, locked_by: nil, handler: '---' end |
.build_queued ⇒ Object
66 67 68 69 70 |
# File 'app/models/delayed/web/job/double.rb', line 66 def self.build_queued new id: 3, created_at: 30.seconds.ago, run_at: 30.seconds.ago, attempts: 0, last_error: nil, locked_at: nil, locked_by: nil, handler: '---' end |
.decorate(job) ⇒ Object
50 51 52 |
# File 'app/models/delayed/web/job/double.rb', line 50 def self.decorate job StatusDecorator.new job end |
.find(*args) ⇒ Object
40 41 42 |
# File 'app/models/delayed/web/job/double.rb', line 40 def self.find *args decorate build_failed end |
Instance Method Details
#destroy ⇒ Object
36 37 38 |
# File 'app/models/delayed/web/job/double.rb', line 36 def destroy self end |
#queue! ⇒ Object
32 33 34 |
# File 'app/models/delayed/web/job/double.rb', line 32 def queue! true end |
#to_param ⇒ Object
28 29 30 |
# File 'app/models/delayed/web/job/double.rb', line 28 def to_param id end |