Class: ActiveJobStatus::JobStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job_status/job_status.rb

Constant Summary collapse

ENQUEUED =
:queued
WORKING =
:working
COMPLETED =
:completed

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status) ⇒ JobStatus

Returns a new instance of JobStatus.



9
10
11
# File 'lib/active_job_status/job_status.rb', line 9

def initialize(status)
  @status = status && status.to_sym
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/active_job_status/job_status.rb', line 7

def status
  @status
end

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/active_job_status/job_status.rb', line 21

def completed?
  status == COMPLETED
end

#empty?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/active_job_status/job_status.rb', line 25

def empty?
  status.nil?
end

#queued?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/active_job_status/job_status.rb', line 13

def queued?
  status == ENQUEUED
end

#working?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/active_job_status/job_status.rb', line 17

def working?
  status == WORKING
end