Method: Fear::FutureApi#future

Defined in:
lib/fear/future_api.rb

#future(**options, &block) ⇒ Fear::Future

Asynchronously evaluates the block

Examples:

require 'open-uri'
f = Fear.future(executor: :io) { open('http://example.com') }
f.map(&:read).each { |body| puts body }

Parameters:

Returns:

[View source] [View on GitHub]

22
23
24
# File 'lib/fear/future_api.rb', line 22

def future(**options, &block)
  Future.new(nil, **options, &block)
end