Sha256: 08ab7af83f7b04391a26e6636e11a182b2c82fc50aa50736e4924edb2a576196

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

# frozen_string_literal: true

module Fear
  # rubocop: disable Metrics/LineLength
  module FutureApi
    # Asynchronously evaluates the block
    # @param options [Hash] options will be passed directly to underlying +Concurrent::Promise+
    #   @see https://ruby-concurrency.github.io/concurrent-ruby/1.1.5/Concurrent/Promise.html#constructor_details Constructor Details
    # @return [Fear::Future]
    #
    # @example
    #   require 'open-uri'
    #   f = Fear.future(executor: :io) { open('http://example.com') }
    #   f.map(&:read).each { |body| puts body }
    #
    def future(options = {}, &block)
      Future.new(options, &block)
    end
  end
  # rubocop: enable Metrics/LineLength
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fear-1.1.0 lib/fear/future_api.rb