Sha256: a3f5f77300406ebdb6726fdd6cf0bb791b2c403d7b50ec16c41f31c05caf6684

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

module Crono
  # Crono::PerformerProxy is a proxy used in cronotab.rb semantic
  class PerformerProxy
    def initialize(performer, scheduler, job_args)
      @performer = performer
      @scheduler = scheduler
      @job_args = job_args
    end

    def every(period, *args)
      @job = Job.new(@performer, Period.new(period, *args), @job_args)
      @scheduler.add_job(@job)
      self
    end

    def once_per(execution_interval)
      @job.execution_interval = execution_interval if @job
      self
    end
  end

  def self.perform(performer, *job_args)
    PerformerProxy.new(performer, Crono.scheduler, job_args)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
crono-1.0.3 lib/crono/performer_proxy.rb
crono-1.0.2 lib/crono/performer_proxy.rb
crono-1.0.1 lib/crono/performer_proxy.rb
crono-1.0.0 lib/crono/performer_proxy.rb
crono-1.0.0.pre3 lib/crono/performer_proxy.rb
crono-1.0.0.pre2 lib/crono/performer_proxy.rb