module MotherBrain::Job::States
A mixin to provide helper functions around the state of a Job
, JobRecord
, or JobTicket
. The helper functions are based on states set by {Job::StateMachine}
Attributes
state[R]
Public Instance Methods
completed?()
click to toggle source
If a job has succeeded or failed it considered completed
@return [Boolean]
# File lib/mb/job/states.rb, line 11 def completed? self.success? || self.failure? end
Also aliased as: finished?
failure?()
click to toggle source
If a job has failed it is considered a failure
@return [Boolean]
# File lib/mb/job/states.rb, line 19 def failure? self.state == :failure end
Also aliased as: failed?
pending?()
click to toggle source
If a job has not begun and is in the pending state it is considered pending
@return [Boolean]
# File lib/mb/job/states.rb, line 27 def pending? self.state == :pending end
running?()
click to toggle source
If a job has begun running and is in the running state it is considered running
@return [Boolean]
# File lib/mb/job/states.rb, line 34 def running? self.state == :running end
success?()
click to toggle source
If a job has succeeded it is considered a success
@return [Boolean]
# File lib/mb/job/states.rb, line 41 def success? self.state == :success end