Class: Mutant::Actor::Binding

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/actor.rb

Overview

Binding to othersactors sender for simple RPC

Instance Method Summary collapse

Instance Method Details

#call(type) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Send message and wait for reply

Parameters:

  • type (Symbol)

Returns:

  • (Object)


55
56
57
58
59
60
# File 'lib/mutant/actor.rb', line 55

def call(type)
  other.call(Message.new(type, mailbox.sender))
  message = mailbox.receiver.call
  fail ProtocolError, "Expected #{type} but got #{message.type}" unless type.equal?(message.type)
  message.payload
end