@@ -91,7 +91,7 @@ def completed?
91
91
# @param [Numeric] timeout the maximum time in second to wait.
92
92
# @return [Obligation] self
93
93
def wait ( timeout = nil )
94
- synchronize { ns_wait ( timeout ) }
94
+ synchronize { ns_wait_until_complete ( timeout ) }
95
95
end
96
96
97
97
def touch
@@ -184,7 +184,7 @@ def with_default_executor(executor = default_executor)
184
184
AllPromise . new ( [ self ] , executor ) . future
185
185
end
186
186
187
- protected
187
+ private
188
188
189
189
def ns_initialize ( promise , default_executor = :fast )
190
190
@promise = promise
@@ -194,9 +194,9 @@ def ns_initialize(promise, default_executor = :fast)
194
194
@touched = false
195
195
end
196
196
197
- def ns_wait ( timeout = nil )
197
+ def ns_wait_until_complete ( timeout = nil )
198
198
ns_touch
199
- super timeout if ns_incomplete?
199
+ ns_wait_until ( timeout ) { ns_completed? }
200
200
self
201
201
end
202
202
@@ -234,11 +234,11 @@ def pr_chain(default_executor, executor = nil, &callback)
234
234
end
235
235
236
236
def pr_delay ( default_executor )
237
- self . pr_join ( default_executor , Delay . new ( default_executor ) . future )
237
+ pr_join ( default_executor , Delay . new ( default_executor ) . future )
238
238
end
239
239
240
240
def pr_schedule ( default_executor , intended_time )
241
- self . pr_chain ( default_executor ) { ScheduledPromise . new ( intended_time ) . future . join ( self ) } . flat
241
+ pr_chain ( default_executor ) { ScheduledPromise . new ( intended_time ) . future . join ( self ) } . flat
242
242
end
243
243
244
244
def pr_join ( default_executor , *futures )
@@ -279,8 +279,6 @@ def ns_add_callback(method, *args)
279
279
self
280
280
end
281
281
282
- private
283
-
284
282
def ns_complete_state
285
283
@state = :completed
286
284
end
@@ -350,7 +348,7 @@ def reason(timeout = nil)
350
348
# @return [Obligation] self
351
349
# @raise [Exception] when #failed? it raises #reason
352
350
def wait! ( timeout = nil )
353
- synchronize { ns_wait ! timeout }
351
+ synchronize { ns_wait_until_complete ! timeout }
354
352
end
355
353
356
354
# @raise [Exception] when #failed? it raises #reason
@@ -427,7 +425,7 @@ def ns_add_callback(method, *args)
427
425
self
428
426
end
429
427
430
- protected
428
+ private
431
429
432
430
def ns_initialize ( promise , default_executor = :fast )
433
431
super ( promise , default_executor )
@@ -448,23 +446,23 @@ def ns_completed?
448
446
end
449
447
450
448
def ns_value ( timeout = nil )
451
- ns_wait timeout
449
+ ns_wait_until_complete timeout
452
450
@value
453
451
end
454
452
455
453
def ns_reason ( timeout = nil )
456
- ns_wait timeout
454
+ ns_wait_until_complete timeout
457
455
@reason
458
456
end
459
457
460
- def ns_wait !( timeout = nil )
461
- ns_wait ( timeout )
458
+ def ns_wait_until_complete !( timeout = nil )
459
+ ns_wait_until_complete ( timeout )
462
460
raise self if ns_failed?
463
461
self
464
462
end
465
463
466
464
def ns_value! ( timeout = nil )
467
- ns_wait !( timeout )
465
+ ns_wait_until_complete !( timeout )
468
466
@value
469
467
end
470
468
0 commit comments