Class: AutomateEm::JobProxy
- Inherits:
-
Object
- Object
- AutomateEm::JobProxy
- Defined in:
- lib/automate-em/utilities.rb
Instance Method Summary collapse
-
#initialize(jobs, index, lock) ⇒ JobProxy
constructor
A new instance of JobProxy.
- #unschedule ⇒ Object
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
#unschedule ⇒ Object
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 |