Skip to content

Instantly share code, notes, and snippets.

@neektza
Created April 14, 2017 17:52
Show Gist options
  • Save neektza/46f812d13634ce063c8a2ea4c6cb49c1 to your computer and use it in GitHub Desktop.
Save neektza/46f812d13634ce063c8a2ea4c6cb49c1 to your computer and use it in GitHub Desktop.
class SyncProxy < AbstractProxy
def method_missing(meth, *args, &block)
# ... snip
call = ::Celluloid::Call::Sync.new(::Celluloid.mailbox, meth, args, block)
@mailbox << call
call.value
end
end
# Async method interception
class AsyncProxy < AbstractProxy
def method_missing(meth, *args, &block)
# ... snip
@mailbox << ::Celluloid::Call::Async.new(meth, args, block)
self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment