mirror of
https://github.com/plashchynski/crono.git
synced 2026-09-18 16:01:27 +02:00
Add Job class
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user