Sha256: 5d0d021904f8cdb583974c7ac180d179e53cf4bdc406b4c590055e8e1b3b0718
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
require 'set' module Orchestrator module Core class ScheduleProxy def initialize(thread) @scheduler = thread.scheduler @schedules = Set.new end attr_reader :schedules def every(*args, &block) add_schedule @scheduler.every(*args, &block) end def in(*args, &block) add_schedule @scheduler.in(*args, &block) end def at(*args, &block) add_schedule @scheduler.at(*args, &block) end def cron(*args, &block) add_schedule @scheduler.cron(*args, &block) end def clear @schedules.each do |schedule| schedule.cancel end end protected def add_schedule(schedule) @schedules.add(schedule) schedule.finally do @schedules.delete(schedule) end schedule end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
orchestrator-1.0.3 | lib/orchestrator/core/schedule_proxy.rb |
orchestrator-1.0.2 | lib/orchestrator/core/schedule_proxy.rb |
orchestrator-1.0.1 | lib/orchestrator/core/schedule_proxy.rb |