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, #every, #find_by_tag, #handle_exception, #in, #initialize, #jobs, start_new, #trigger_threads, #unschedule

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



371
372
373
374
# File 'lib/rufus/sc/scheduler.rb', line 371

def join

  @thread.join
end

#startObject



352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/rufus/sc/scheduler.rb', line 352

def start

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

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

#stop(opts = {}) ⇒ Object



366
367
368
369
# File 'lib/rufus/sc/scheduler.rb', line 366

def stop (opts={})

  @thread.exit
end