Sha256: 72116ad9cc3daa2d45948f82f4ce8fcb91d08eec0676abf1ac335221f4c8268e
Contents?: true
Size: 944 Bytes
Versions: 1
Compression:
Stored size: 944 Bytes
Contents
require "promising/version" require "promising/promise" require "promising/future" module Kernel ## # Creates a new promise. # # @example Lazily evaluate an arithmetic operation # x = promise { 3 + 3 } # # @yield [] # A block to be lazily evaluated. # @yieldreturn [Object] # The return value of the block will be the lazily evaluated value of the promise. # @return [Promise] def promise(timeout:nil,&block) ::Promising::Promise.new(timeout:timeout,&block) end ## # Creates a new future. # # @example Evaluate an operation in another thread # x = future { 3 + 3 } # # @yield [] # A block to be optimistically evaluated in another thread. # @yieldreturn [Object] # The return value of the block will be the evaluated value of the future. # @return [Future] def future(timeout:nil, &block) ::Promising::Future.new(timeout:timeout, &block) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
promising-0.3.1 | lib/promising.rb |