lib/rufus/sc/scheduler.rb in rufus-scheduler-2.0.8 vs lib/rufus/sc/scheduler.rb in rufus-scheduler-2.0.9

- old
+ new

@@ -182,10 +182,20 @@ def unschedule(job_id) @jobs.unschedule(job_id) || @cron_jobs.unschedule(job_id) end + # Given a tag, unschedules all the jobs that bear that tag. + # + def unschedule_by_tag(tag) + + jobs = find_by_tag(tag) + jobs.each { |job| unschedule(job.job_id) } + + jobs + end + #-- # MISC #++ # Feel free to override this method. The default implementation simply @@ -295,10 +305,10 @@ def add_job(job) complain_if_blocking_and_timeout(job) - return if job.params[:discard_past] && Time.now.to_f >= job.at + return nil if job.params[:discard_past] && Time.now.to_f >= job.at @jobs << job job end