class Core::Async::Wrapper

public

Wraps an object, calling all methods in an async context.

Public Class Methods

new(target) click to toggle source
# File lib/core/async/wrapper.rb, line 8
def initialize(target)
  unless target.respond_to?(:async)
    ::Kernel.raise ::ArgumentError, "object is not async-aware"
  end

  @target = target
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source
# File lib/core/async/wrapper.rb, line 16
def method_missing(name, *args, &block)
  @target.async do
    @target.public_send(name, *args, &block)
  end
end
respond_to_missing?(name, *) click to toggle source
# File lib/core/async/wrapper.rb, line 24
def respond_to_missing?(name, *)
  true
end