Class: QueueToTheFuture::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_to_the_future/job.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Job

Returns a new instance of Job.



5
6
7
8
# File 'lib/queue_to_the_future/job.rb', line 5

def initialize(*args, &block)
  @args   = args
  @block  = block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



14
15
16
17
# File 'lib/queue_to_the_future/job.rb', line 14

def method_missing(*args, &block)
  Thread.pass while !defined?(@result)
  @result.send(*args, &block)
end

Instance Method Details

#__execute__Object



10
11
12
# File 'lib/queue_to_the_future/job.rb', line 10

def __execute__
  @result = @block.call(*@args)
end