Module: ActiveJob::Cron

Extended by:
Configurable, Schedulable, Trackable
Defined in:
lib/active_job/cron.rb,
lib/active_job/cron/clock.rb,
lib/active_job/cron/handler.rb,
lib/active_job/cron/railtie.rb,
lib/active_job/cron/version.rb,
lib/active_job/cron/loggable.rb,
lib/active_job/cron/trackable.rb,
lib/active_job/cron/supervisor.rb,
lib/active_job/cron/schedulable.rb,
lib/active_job/cron/configuration.rb

Defined Under Namespace

Modules: Configurable, Loggable, Schedulable, Trackable Classes: Clock, Configuration, Handler, Railtie, Supervisor

Constant Summary collapse

VERSION =
"0.1.0"

Instance Attribute Summary

Attributes included from Schedulable

#last_occurrence

Class Method Summary collapse

Methods included from Configurable

config, configure

Methods included from Trackable

inherited, subclasses

Methods included from Schedulable

method_missing, ready_to_perform?, recurrence, schedule

Class Method Details

.clockObject



43
44
45
46
47
48
49
50
# File 'lib/active_job/cron.rb', line 43

def clock
  if clock = Supervisor.clock
    clock
  else
    run!
    Supervisor.clock
  end
end

.handlerObject



34
35
36
37
38
39
40
41
# File 'lib/active_job/cron.rb', line 34

def handler
  if handler = Supervisor.handler
    handler
  else
    run!
    Supervisor.handler
  end
end

.included(klass) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/active_job/cron.rb', line 18

def self.included(klass)
  super

  klass.extend(ActiveJob::Cron::Schedulable)
  klass.extend(ActiveJob::Cron::Trackable)

  subclasses << klass
end

.jobsObject



28
29
30
31
32
# File 'lib/active_job/cron.rb', line 28

def jobs
  subclasses(true).select do |job|
    job.method_defined?(:perform)
  end
end

.run!Object



52
53
54
# File 'lib/active_job/cron.rb', line 52

def run!
  Supervisor.run!
end