mirror of
https://github.com/plashchynski/crono.git
synced 2026-03-26 19:31:39 +01:00
Add PerformerProxy
This commit is contained in:
@@ -5,3 +5,4 @@ require "active_support/all"
|
||||
require "periodicity/version.rb"
|
||||
require "periodicity/period.rb"
|
||||
require "periodicity/config.rb"
|
||||
require "periodicity/performer_proxy.rb"
|
||||
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