Class: Concurrent::Async::AwaitDelegator
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/concurrent-ruby/concurrent/async.rb |
Overview
Delegates synchronous, thread-safe method calls to the wrapped object.
Class Method Summary
-
.new(delegate) ⇒ AwaitDelegator
constructor
Create a new delegator object wrapping the given delegate.
Instance Method Summary
-
#method_missing(method, *args, &block) ⇒ IVar
Delegates method calls to the wrapped object.
-
#respond_to_missing?(method, include_private = false) ⇒ Boolean
Check whether the method is responsive.
Constructor Details
.new(delegate) ⇒ AwaitDelegator
Create a new delegator object wrapping the given delegate.
# File 'lib/concurrent-ruby/concurrent/async.rb', line 365
def initialize(delegate) @delegate = delegate end
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ IVar
Delegates method calls to the wrapped object.
# File 'lib/concurrent-ruby/concurrent/async.rb', line 378
def method_missing(method, *args, &block) ivar = @delegate.send(method, *args, &block) ivar.wait ivar end
Instance Method Details
#respond_to_missing?(method, include_private = false) ⇒ Boolean
Check whether the method is responsive
# File 'lib/concurrent-ruby/concurrent/async.rb', line 387
def respond_to_missing?(method, include_private = false) @delegate.respond_to?(method) || super end