Skip to content

Commit c1d0dd9

Browse files
committed
leave _using suffix just for callbacks
1 parent d6d1dd2 commit c1d0dd9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/concurrent/edge/promises.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def default_executor
567567
# @!macro promises.shortcut.using
568568
# @return [Future]
569569
def chain(*args, &task)
570-
chain_using @DefaultExecutor, *args, &task
570+
chain_on @DefaultExecutor, *args, &task
571571
end
572572

573573
# Chains the task to be executed asynchronously on executor after it is resolved.
@@ -577,11 +577,11 @@ def chain(*args, &task)
577577
# @return [Future]
578578
# @!macro promise.param.task-future
579579
#
580-
# @overload an_event.chain_using(executor, *args, &task)
580+
# @overload an_event.chain_on(executor, *args, &task)
581581
# @yield [*args] to the task.
582-
# @overload a_future.chain_using(executor, *args, &task)
582+
# @overload a_future.chain_on(executor, *args, &task)
583583
# @yield [fulfilled?, value, reason, *args] to the task.
584-
def chain_using(executor, *args, &task)
584+
def chain_on(executor, *args, &task)
585585
ChainPromise.new(self, @DefaultExecutor, executor, args, &task).future
586586
end
587587

@@ -935,7 +935,7 @@ def exception(*args)
935935
# @!macro promises.shortcut.using
936936
# @return [Future]
937937
def then(*args, &task)
938-
then_using @DefaultExecutor, *args, &task
938+
then_on @DefaultExecutor, *args, &task
939939
end
940940

941941
# Chains the task to be executed asynchronously on executor after it fulfills. Does not run
@@ -946,14 +946,14 @@ def then(*args, &task)
946946
# @!macro promise.param.task-future
947947
# @return [Future]
948948
# @yield [value, *args] to the task.
949-
def then_using(executor, *args, &task)
949+
def then_on(executor, *args, &task)
950950
ThenPromise.new(self, @DefaultExecutor, executor, args, &task).future
951951
end
952952

953953
# @!macro promises.shortcut.using
954954
# @return [Future]
955955
def rescue(*args, &task)
956-
rescue_using @DefaultExecutor, *args, &task
956+
rescue_on @DefaultExecutor, *args, &task
957957
end
958958

959959
# Chains the task to be executed asynchronously on executor after it rejects. Does not run
@@ -964,7 +964,7 @@ def rescue(*args, &task)
964964
# @!macro promise.param.task-future
965965
# @return [Future]
966966
# @yield [reason, *args] to the task.
967-
def rescue_using(executor, *args, &task)
967+
def rescue_on(executor, *args, &task)
968968
RescuePromise.new(self, @DefaultExecutor, executor, args, &task).future
969969
end
970970

spec/concurrent/promises_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def behaves_as_delay(delay, value)
298298

299299
it 'chains' do
300300
future0 = future { 1 }.then { |v| v + 2 } # both executed on default FAST_EXECUTOR
301-
future1 = future0.then_using(:fast) { raise 'boo' } # executed on IO_EXECUTOR
301+
future1 = future0.then_on(:fast) { raise 'boo' } # executed on IO_EXECUTOR
302302
future2 = future1.then { |v| v + 1 } # will reject with 'boo' error, executed on default FAST_EXECUTOR
303303
future3 = future1.rescue { |err| err.message } # executed on default FAST_EXECUTOR
304304
future4 = future0.chain { |success, value, reason| success } # executed on default FAST_EXECUTOR

0 commit comments

Comments
 (0)