Module: Jobit::Jobs::Statuses

Included in:
Jobit::Jobby
Defined in:
lib/jobit/jobs/statuses.rb

Instance Method Summary collapse

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/jobit/jobs/statuses.rb', line 12

def complete?
  status == 'complete'
end

#current_jobObject



32
33
34
# File 'lib/jobit/jobs/statuses.rb', line 32

def current_job
  self
end

#failed?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/jobit/jobs/statuses.rb', line 8

def failed?
  status == 'failed'
end

#keep?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/jobit/jobs/statuses.rb', line 24

def keep?
  keep
end

#locked?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/jobit/jobs/statuses.rb', line 28

def locked?
  locked_at != nil
end

#new?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/jobit/jobs/statuses.rb', line 20

def new?
  status == 'new'
end

#running?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/jobit/jobs/statuses.rb', line 4

def running?
  status == 'running'
end

#sessionObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/jobit/jobs/statuses.rb', line 36

def session
  {
    :name => name,
    :message => message,
    :progress => progress,
    :error => error,
    :run_at => run_at,
    :created_at => created_at,
    :started_at => started_at,
    :stopped_at =>stopped_at,
    :tries => tries,
    :status => status,
    :failed_at => failed_at
  }
end

#stopped?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/jobit/jobs/statuses.rb', line 16

def stopped?
  status == 'stopped'
end

#time_to_run?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
# File 'lib/jobit/jobs/statuses.rb', line 52

def time_to_run?
  if tries == 0
    Time.now.to_f >= run_at.to_f
  else
    true
  end
end