Skip to content

Commit 3d62bdf

Browse files
committed
Adding doc for shortcut methods.
1 parent a14278a commit 3d62bdf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/concurrent/next.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,24 @@ class SynchronizedObject < RubySynchronizedObject
128128
class Future < SynchronizedObject
129129
module Shortcuts
130130

131+
# Constructs new Future which will be completed after block is evaluated on executor. Evaluation begins immediately.
131132
# @return [Future]
132133
def future(executor = :fast, &block)
133134
ConcurrentNext::Immediate.new(executor, &block).future
134135
end
135136

136137
alias_method :async, :future
137138

139+
# Constructs new Future which will be completed after block is evaluated on executor. Evaluation is delays until
140+
# requested by {Future#wait} method, {Future#value} and {Future#value!} methods are calling {Future#wait} internally.
138141
# @return [Delay]
139142
def delay(executor = :fast, &block)
140143
ConcurrentNext::Delay.new(nil, executor, &block).future
141144
end
142145

146+
# Constructs {Promise} which helds its {Future} in {Promise#future} method. Intended for completion by user.
147+
# User is responsible not to complete the Promise twice.
148+
# @return [Promise] in this case instance of {OuterPromise}
143149
def promise(executor = :fast)
144150
ConcurrentNext::OuterPromise.new([], executor)
145151
end

0 commit comments

Comments
 (0)