Class: AutomateEm::JobProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/automate-em/utilities.rb

Instance Method Summary collapse

Constructor Details

#initialize(jobs, index, lock) ⇒ JobProxy

Returns a new instance of JobProxy.



23
24
25
26
27
28
# File 'lib/automate-em/utilities.rb', line 23

def initialize(jobs, index, lock)
	@jobs = jobs
	@index = index
	@lock = lock
	@job = @jobs[@index]	# only ever called from within the lock
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



40
41
42
43
44
# File 'lib/automate-em/utilities.rb', line 40

def method_missing(name, *args, &block)
	@lock.synchronize do
		@job.send(name, *args, &block)
	end
end

Instance Method Details

#unscheduleObject



31
32
33
34
35
36
# File 'lib/automate-em/utilities.rb', line 31

def unschedule
	@lock.synchronize do
		@job.unschedule
		@jobs.delete(@index)
	end
end