Module: Rufus::Scheduler

Defined in:
lib/rufus/sc/jobs.rb,
lib/rufus/scheduler.rb,
lib/rufus/sc/version.rb,
lib/rufus/sc/jobqueues.rb,
lib/rufus/sc/scheduler.rb

Defined Under Namespace

Modules: LegacyMethods, Schedulable Classes: AtJob, CronJob, CronJobQueue, EmScheduler, EveryJob, InJob, Job, JobQueue, PlainScheduler, SchedulerCore, SignalScheduler, SimpleJob, TimeOutError

Constant Summary collapse

VERSION =
'2.0.7.2'

Class Method Summary collapse

Class Method Details

.is_cron_string(s) ⇒ Object

Returns true if the given string seems to be a cron string.



50
51
52
53
# File 'lib/rufus/scheduler.rb', line 50

def self.is_cron_string (s)

  s.match(/.+ .+ .+ .+ .+/) # well...
end

.start_new(opts = {}) ⇒ Object

A quick way to get a scheduler up an running

require 'rubygems'
s = Rufus::Scheduler.start_new

If EventMachine is present and running will create an EmScheduler, else it will create a PlainScheduler instance.



39
40
41
42
43
44
45
46
# File 'lib/rufus/scheduler.rb', line 39

def self.start_new (opts={})

  if defined?(EM) and EM.reactor_running?
    EmScheduler.start_new(opts)
  else
    PlainScheduler.start_new(opts)
  end
end