Class: Celluloid::ActorProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/dcell/celluloid_ext.rb

Direct Known Subclasses

DCell::ActorProxy

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(string) ⇒ Object

Create an actor proxy object which routes messages over DCell’s overlay network and back to the original mailbox



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dcell/celluloid_ext.rb', line 30

def self._load(string)
  mailbox = Celluloid::Mailbox._load(string)

  case mailbox
  when DCell::MailboxProxy
    DCell::ActorProxy.new mailbox
  when Celluloid::Mailbox
    Celluloid::ActorProxy.new(mailbox)
  else raise "funny, I did not expect to see a #{mailbox.class} here"
  end
end

Instance Method Details

#__respond_to?Object

Marshal uses respond_to? to determine if this object supports _dump so unfortunately we have to monkeypatch in _dump support as the proxy itself normally jacks respond_to? and proxies to the actor



16
# File 'lib/dcell/celluloid_ext.rb', line 16

alias_method :__respond_to?, :respond_to?

#_dump(level) ⇒ Object

Dump an actor proxy via its mailbox



24
25
26
# File 'lib/dcell/celluloid_ext.rb', line 24

def _dump(level)
  @mailbox._dump(level)
end

#respond_to?(meth) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
# File 'lib/dcell/celluloid_ext.rb', line 17

def respond_to?(meth)
  return false if meth == :marshal_dump
  return true  if meth == :_dump
  __respond_to? meth
end