module AsyncIO
Public Class Methods
async(task = proc {}, &payload)
click to toggle source
Creates async jobs, if a payload (i.e ruby block) is not given it passes an empty payload to woker. That allows us to do:
User.aget(1) User.aget(1) { |u| print u.id }
The response will be a worker that was created for this particular job.
NOTE: If you read PredictionIO::Worker you will see that it calls payload and passes job as its arguments. This is how it is available within a block later on. NOTE: You must pass a job ( i.e ruby block ).
# File lib/async_io.rb, line 29 def self.async(task = proc {}, &payload) async_creator.worker(payload, task) end
async_creator()
click to toggle source
# File lib/async_io.rb, line 9 def self.async_creator @@async_creator ||= Base.new(5) end
async_creator=(new_async)
click to toggle source
# File lib/async_io.rb, line 5 def self.async_creator=(new_async) @@async_creator = new_async end
async_with(task)
click to toggle source
# File lib/async_io.rb, line 33 def self.async_with(task) async_creator.async_with(task) end