class Celluloid::SyncProxy - celluloid-0.16.0 Documentation

# class Celluloid::SyncProxy

A proxy which sends synchronous calls to an actor

### Attributes

mailbox[R]

### Public Class Methods

new(mailbox, klass) click to toggle source

    # File lib/celluloid/proxies/sync_proxy.rb, line 9
    def initialize(mailbox, klass)
      @mailbox, @klass = mailbox, klass
    end

### Public Instance Methods

__class__() click to toggle source

Used for reflecting on proxy objects themselves

    # File lib/celluloid/proxies/sync_proxy.rb, line 7
    def __class__; SyncProxy; end

inspect() click to toggle source

    # File lib/celluloid/proxies/sync_proxy.rb, line 13
    def inspect
      "#<Celluloid::SyncProxy(#{@klass})>"
    end

method_missing(meth, *args, &block) click to toggle source

    # File lib/celluloid/proxies/sync_proxy.rb, line 21
    def method_missing(meth, *args, &block)
      unless @mailbox.alive?
        raise DeadActorError, "attempted to call a dead actor"
      end

      if @mailbox == ::Thread.current[:celluloid_mailbox]
        args.unshift meth
        meth = :__send__
      end

      call = SyncCall.new(::Celluloid.mailbox, meth, args, block)
      @mailbox << call
      call.value
    end

respond_to?(meth, include_private = false) click to toggle source

    # File lib/celluloid/proxies/sync_proxy.rb, line 17
    def respond_to?(meth, include_private = false)
      __class__.instance_methods.include?(meth) || method_missing(:respond_to?, meth, include_private)
    end