Sha256: 18c6a25ebe7d541fcdeb3507e61c2fc1df9553e07360a1075bd3b931f9fae40b

Contents?: true

Size: 491 Bytes

Versions: 10

Compression:

Stored size: 491 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)
      Actor.async @mailbox, meth, *args, &block
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
celluloid-0.12.4 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.4.pre2 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.4.pre lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.3 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.2 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.1 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.1.pre2 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.1.pre lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.0 lib/celluloid/proxies/async_proxy.rb
celluloid-0.12.0.pre3 lib/celluloid/proxies/async_proxy.rb