Add Job class

This commit is contained in:
Dzmitry Plashchynski
2015-03-04 18:31:59 +02:00
parent 36c35bce7d
commit 828488a6bc
10 changed files with 91 additions and 38 deletions
+19
View File
@@ -0,0 +1,19 @@
module Crono
class Job
attr_accessor :performer
attr_accessor :period
def initialize(performer, period)
self.performer, self.period = performer, period
end
def next
period.next
end
def perform
Crono.logger.info "Perform #{performer}"
Thread.new { performer.new.perform }
end
end
end