mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-22 08:48:38 +02:00
Add PerformerProxy
This commit is contained in:
15
lib/periodicity/performer_proxy.rb
Normal file
15
lib/periodicity/performer_proxy.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
module Periodicity
|
||||
class PerformerProxy
|
||||
def initialize(performer)
|
||||
@performer = performer
|
||||
end
|
||||
|
||||
def every(period, *args)
|
||||
Config.instance.schedule += [@performer, Period.new(period, *args)]
|
||||
end
|
||||
end
|
||||
|
||||
def self.perform(performer)
|
||||
PerformerProxy.new(performer)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user