Class: Crono::PerformerProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/crono/performer_proxy.rb

Overview

Crono::PerformerProxy is a proxy used in cronotab.rb semantic

Instance Method Summary collapse

Constructor Details

#initialize(performer, scheduler, job_args) ⇒ PerformerProxy

Returns a new instance of PerformerProxy.



4
5
6
7
8
# File 'lib/crono/performer_proxy.rb', line 4

def initialize(performer, scheduler, job_args)
  @performer = performer
  @scheduler = scheduler
  @job_args = job_args
end

Instance Method Details

#every(period, *args) ⇒ Object



10
11
12
13
14
# File 'lib/crono/performer_proxy.rb', line 10

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

#once_per(execution_interval) ⇒ Object



16
17
18
19
# File 'lib/crono/performer_proxy.rb', line 16

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

#with_options(options) ⇒ Object



21
22
23
24
# File 'lib/crono/performer_proxy.rb', line 21

def with_options(options)
  @options = options
  self
end