Class: GoFlippy::Worker
- Inherits:
-
Object
- Object
- GoFlippy::Worker
- Includes:
- Logger
- Defined in:
- lib/goflippy-ruby/worker.rb
Constant Summary
Constants included from Logger
Class Method Summary collapse
Methods included from Logger
debug, error, fatal, info, logger, logger=, unknown, warn
Class Method Details
.create(interval, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/goflippy-ruby/worker.rb', line 7 def self.create(interval, &block) Thread.new do loop do begin started_at = Time.now yield sleep(interval) if (interval - (Time.now - started_at)).positive? rescue StandardError => e Logger.error(e) end end end end |