Module: Jobit::Jobs::Statuses
- Included in:
- Jobit::Jobby
- Defined in:
- lib/jobit/jobs/statuses.rb
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #current_job ⇒ Object
- #failed? ⇒ Boolean
- #keep? ⇒ Boolean
- #locked? ⇒ Boolean
- #new? ⇒ Boolean
- #running? ⇒ Boolean
- #session ⇒ Object
- #stopped? ⇒ Boolean
- #time_to_run? ⇒ Boolean
Instance Method Details
#complete? ⇒ Boolean
12 13 14 |
# File 'lib/jobit/jobs/statuses.rb', line 12 def complete? status == 'complete' end |
#current_job ⇒ Object
32 33 34 |
# File 'lib/jobit/jobs/statuses.rb', line 32 def current_job self end |
#failed? ⇒ Boolean
8 9 10 |
# File 'lib/jobit/jobs/statuses.rb', line 8 def failed? status == 'failed' end |
#keep? ⇒ Boolean
24 25 26 |
# File 'lib/jobit/jobs/statuses.rb', line 24 def keep? keep end |
#locked? ⇒ Boolean
28 29 30 |
# File 'lib/jobit/jobs/statuses.rb', line 28 def locked? locked_at != nil end |
#new? ⇒ Boolean
20 21 22 |
# File 'lib/jobit/jobs/statuses.rb', line 20 def new? status == 'new' end |
#running? ⇒ Boolean
4 5 6 |
# File 'lib/jobit/jobs/statuses.rb', line 4 def running? status == 'running' end |
#session ⇒ Object
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 => , :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
16 17 18 |
# File 'lib/jobit/jobs/statuses.rb', line 16 def stopped? status == 'stopped' end |
#time_to_run? ⇒ 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 |