Module: Fear::FutureApi

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

Overview

rubocop: disable Metrics/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 }

16
17
18
# File 'lib/fear/future_api.rb', line 16

def future(options = {}, &block)
  Future.new(options, &block)
end