class Celluloid::Proxy::Sync

A proxy which sends synchronous calls to an actor

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
# File lib/celluloid/proxy/sync.rb, line 7
def method_missing(meth, *args, &block)
  unless @mailbox.alive?
    fail ::Celluloid::DeadActorError, "attempted to call a dead actor: #{meth}"
  end

  if @mailbox == ::Thread.current[:celluloid_mailbox]
    args.unshift meth
    meth = :__send__
    # actor = Thread.current[:celluloid_actor]
    # actor = actor.behavior.subject.bare_object
    # return actor.__send__(*args, &block)
  end

  call = ::Celluloid::Call::Sync.new(::Celluloid.mailbox, meth, args, block)
  @mailbox << call
  call.value
end
respond_to?(meth, include_private = false) click to toggle source
# File lib/celluloid/proxy/sync.rb, line 3
def respond_to?(meth, include_private = false)
  __class__.instance_methods.include?(meth) || method_missing(:respond_to?, meth, include_private)
end