Module: Fear::FutureApi

Included in:
Fear
Defined in:
lib/fear/future_api.rb

Overview

rubocop: disable Layout/LineLength

Instance Method Summary collapse

Instance Method Details

#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:



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

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