Method: Async::Task.current

Defined in:
lib/async/task.rb

.currentAsync::Task

Lookup the Async::Task for the current fiber. Raise ‘RuntimeError` if none is available.

Returns:

Raises:

  • (RuntimeError)

    if task was not #set! for the current fiber.



191
192
193
# File 'lib/async/task.rb', line 191

def self.current
	Thread.current[:async_task] or raise RuntimeError, "No async task available!"
end