Sha256: aa41496167628fd4d5e4186cc93de613b1c6f13906372157ef786b2779064e2a
Contents?: true
Size: 633 Bytes
Versions: 3
Compression:
Stored size: 633 Bytes
Contents
module Celluloid # A proxy which sends asynchronous calls to an actor class AsyncProxy < AbstractProxy attr_reader :mailbox def initialize(actor) @mailbox, @klass = actor.mailbox, actor.subject.class.to_s end def inspect "#<Celluloid::AsyncProxy(#{@klass})>" end # method_missing black magic to call bang predicate methods asynchronously def method_missing(meth, *args, &block) if @mailbox == ::Thread.current[:celluloid_mailbox] Actor.async @mailbox, :__send__, meth, *args, &block else Actor.async @mailbox, meth, *args, &block end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
celluloid-0.13.0 | lib/celluloid/proxies/async_proxy.rb |
celluloid-0.13.0.pre2 | lib/celluloid/proxies/async_proxy.rb |
celluloid-0.13.0.pre | lib/celluloid/proxies/async_proxy.rb |