Class: Rufus::Scheduler::OneTimeJob

Inherits:
Job
  • Object
show all
Defined in:
lib/rufus/scheduler/jobs_one_time.rb

Direct Known Subclasses

AtJob, InJob

Constant Summary

Constants inherited from Job

Job::EoTime

Instance Attribute Summary

Attributes inherited from Job

#callable, #count, #handler, #id, #last_time, #last_work_time, #locals, #mean_work_time, #name, #next_time, #opts, #original, #previous_time, #scheduled_at, #tags, #unscheduled_at

Instance Method Summary collapse

Methods inherited from Job

#[], #[]=, #call, #check_frequency, #entries, #has_key?, #initialize, #keys, #kill, #next_times, #resume_discard_past=, #running?, #scheduled?, #source_location, #threads, #trigger, #trigger_off_schedule, #unschedule, #values

Constructor Details

This class inherits a constructor from Rufus::Scheduler::Job

Instance Method Details

#occurrences(time0, time1) ⇒ Object



6
7
8
9
# File 'lib/rufus/scheduler/jobs_one_time.rb', line 6

def occurrences(time0, time1)

  (time >= time0 && time <= time1) ? [ time ] : []
end

#past?Boolean

Used when discard_past? is set to true or :fail at scheduler or job level…

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/rufus/scheduler/jobs_one_time.rb', line 13

def past?

  @next_time &&
  @next_time < Time.now - @scheduler.frequency
end