Class: Rufus::Scheduler::PlainScheduler

Inherits:
SchedulerCore show all
Defined in:
lib/rufus/sc/scheduler.rb

Overview

A classical implementation, uses a sleep/step loop in a thread (like the original rufus-scheduler).

Instance Attribute Summary

Attributes inherited from SchedulerCore

#options

Instance Method Summary collapse

Methods inherited from SchedulerCore

#all_jobs, #at, #cron, #cron_jobs, #do_handle_exception, #every, #find, #find_by_tag, #in, #initialize, #jobs, #pause, #resume, #running_jobs, start_new, #trigger_threads, #unschedule, #unschedule_by_tag

Methods included from LegacyMethods

#at_job_count, #cron_job_count, #every_job_count, #find_jobs, #pending_job_count, #precision

Constructor Details

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

Instance Method Details

#joinObject



450
451
452
453
# File 'lib/rufus/sc/scheduler.rb', line 450

def join

  @thread.join
end

#startObject



431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/rufus/sc/scheduler.rb', line 431

def start

  @thread = Thread.new do
    loop do
      sleep(@frequency)
      step
    end
  end

  @thread[:name] =
    @options[:thread_name] ||
    "#{self.class} - #{Rufus::Scheduler::VERSION}"
end

#stop(opts = {}) ⇒ Object



445
446
447
448
# File 'lib/rufus/sc/scheduler.rb', line 445

def stop(opts={})

  @thread.exit
end