Sha256: c4ded5168aadf9500e61405c81731c4466f053f0c6cb10b7385dc2213535910e

Contents?: true

Size: 774 Bytes

Versions: 15

Compression:

Stored size: 774 Bytes

Contents

module Celluloid
  # A proxy which creates future calls to an actor
  class FutureProxy < AbstractProxy
    attr_reader :mailbox

    # Used for reflecting on proxy objects themselves
    def __class__; FutureProxy; end

    def initialize(mailbox, klass)
      @mailbox, @klass = mailbox, klass
    end

    def inspect
      "#<Celluloid::FutureProxy(#{@klass})>"
    end

    def method_missing(meth, *args, &block)
      unless @mailbox.alive?
        raise DeadActorError, "attempted to call a dead actor"
      end

      if block_given?
        # FIXME: nicer exception
        raise "Cannot use blocks with futures yet"
      end

      future = Future.new
      call = SyncCall.new(future, meth, args, block)

      @mailbox << call

      future
    end
  end
end

Version data entries

15 entries across 13 versions & 5 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/celluloid-0.16.0/lib/celluloid/proxies/future_proxy.rb
celluloid-0.16.0 lib/celluloid/proxies/future_proxy.rb
celluloid-0.16.0.pre3 lib/celluloid/proxies/future_proxy.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/proxies/future_proxy.rb
celluloid-0.16.0.pre2 lib/celluloid/proxies/future_proxy.rb
celluloid-0.16.0.pre lib/celluloid/proxies/future_proxy.rb
celluloid-0.15.2 lib/celluloid/proxies/future_proxy.rb
celluloid-0.15.1 lib/celluloid/proxies/future_proxy.rb
celluloid-0.15.0 lib/celluloid/proxies/future_proxy.rb
celluloid-0.15.0.pre2 lib/celluloid/proxies/future_proxy.rb
celluloid-0.15.0.pre lib/celluloid/proxies/future_proxy.rb