mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-20 16:01:30 +02:00
Add basic Period class
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
module Periodicity
|
||||
end
|
||||
|
||||
require "active_support/all"
|
||||
require "periodicity/version.rb"
|
||||
require "periodicity/period.rb"
|
||||
require "periodicity/rails.rb"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
module Periodicity
|
||||
module Extensions
|
||||
class ActiveJob
|
||||
def perform_every(period, *args)
|
||||
def self.perform_every(period, *args)
|
||||
@period = period
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
11
lib/periodicity/period.rb
Normal file
11
lib/periodicity/period.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
module Periodicity
|
||||
class Period
|
||||
def initialize(period)
|
||||
@period = period
|
||||
end
|
||||
|
||||
def next
|
||||
@period.from_now
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user