Module: MotherBrain::Job::States Private
- Defined in:
- lib/mb/job/states.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
A mixin to provide helper functions around the state of a Job, JobRecord, or JobTicket. The helper functions are based on states set by StateMachine
Instance Attribute Summary collapse
- #state ⇒ Object readonly private
Instance Method Summary collapse
-
#completed? ⇒ Boolean
(also: #finished?)
private
If a job has succeeded or failed it considered completed.
-
#failure? ⇒ Boolean
(also: #failed?)
private
If a job has failed it is considered a failure.
-
#pending? ⇒ Boolean
private
If a job has not begun and is in the pending state it is considered pending.
-
#running? ⇒ Boolean
private
If a job has begun running and is in the running state it is considered running.
-
#success? ⇒ Boolean
private
If a job has succeeded it is considered a success.
Instance Attribute Details
#state ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 |
# File 'lib/mb/job/states.rb', line 6 def state @state end |
Instance Method Details
#completed? ⇒ Boolean Also known as: finished?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a job has succeeded or failed it considered completed
11 12 13 |
# File 'lib/mb/job/states.rb', line 11 def completed? self.success? || self.failure? end |
#failure? ⇒ Boolean Also known as: failed?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a job has failed it is considered a failure
19 20 21 |
# File 'lib/mb/job/states.rb', line 19 def failure? self.state == :failure end |
#pending? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a job has not begun and is in the pending state it is considered pending
27 28 29 |
# File 'lib/mb/job/states.rb', line 27 def pending? self.state == :pending end |
#running? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a job has begun running and is in the running state it is considered running
34 35 36 |
# File 'lib/mb/job/states.rb', line 34 def running? self.state == :running end |
#success? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
If a job has succeeded it is considered a success
41 42 43 |
# File 'lib/mb/job/states.rb', line 41 def success? self.state == :success end |