Module: Kernel

Defined in:
lib/queue_to_the_future.rb

Instance Method Summary collapse

Instance Method Details

#Future(*args, &block) ⇒ QueueToTheFuture::Job

Main interface for asynchronous job scheduling. (Where the magick begins)

Examples:

http        = Net::HTTP.new("ia.media-imdb.com")
image_path  = "/images/M/MV5BMTkzNDQyMjc0OV5BMl5BanBnXkFtZTcwNDQ4MDYyMQ@@._V1._SX100_SY133_.jpg"

image = Future(image_path) do |path|
  http.request(Net::HTTP::Get.new(path)).body
end

# do other things

puts image.size # => 6636

Parameters:

  • *args (List)

    The list of arguments to pass to the given block

  • &block (Proc)

    The block to be executed

Returns:



49
50
51
# File 'lib/queue_to_the_future.rb', line 49

def Future(*args, &block)
  QueueToTheFuture::Job.new(*args, &block)
end