Module: ScheduledTask::Status
- Included in:
- ScheduledTask
- Defined in:
- app/models/scheduled_task/status.rb
Instance Method Summary collapse
- #ended?(time, oposite_time) ⇒ Boolean
- #failed? ⇒ Boolean
- #running? ⇒ Boolean
- #status ⇒ Object
- #waiting? ⇒ Boolean
Instance Method Details
#ended?(time, oposite_time) ⇒ Boolean
23 24 25 |
# File 'app/models/scheduled_task/status.rb', line 23 def ended?(time, oposite_time) !running? && time.present? && (oposite_time.blank? || oposite_time < time) end |
#failed? ⇒ Boolean
19 20 21 |
# File 'app/models/scheduled_task/status.rb', line 19 def failed? ended?(last_run_unsuccessful_end, last_run_successful_end) end |
#running? ⇒ Boolean
10 11 12 |
# File 'app/models/scheduled_task/status.rb', line 10 def running? last_run_start.present? end |
#status ⇒ Object
3 4 5 6 7 8 |
# File 'app/models/scheduled_task/status.rb', line 3 def status return STATUS_RUNNING if running? return STATUS_WAITING if waiting? return STATUS_FAILED if failed? fail "Unknown status (#{status_attributes_values})" end |
#waiting? ⇒ Boolean
14 15 16 17 |
# File 'app/models/scheduled_task/status.rb', line 14 def waiting? return true if ended?(last_run_successful_end, last_run_unsuccessful_end) status_attributes.all? { |a| send(a).blank? } end |