Class: EMRPC::Pid::Marshallable

Inherits:
Object
  • Object
show all
Defined in:
lib/emrpc/util/codec.rb

Overview

The purpose of that class is to discard all the class information about Pid before marshalling it. The only thing we want to pass around is pid.uuid.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid) ⇒ Marshallable

Returns a new instance of Marshallable.



95
96
97
# File 'lib/emrpc/util/codec.rb', line 95

def initialize(uuid)
  @uuid = uuid
end

Instance Attribute Details

#uuidObject

Returns the value of attribute uuid.



94
95
96
# File 'lib/emrpc/util/codec.rb', line 94

def uuid
  @uuid
end

Instance Method Details

#_uid(uuid = @uuid) ⇒ Object

shorter uuid for pretty output



108
109
110
# File 'lib/emrpc/util/codec.rb', line 108

def _uid(uuid = @uuid)
  uuid && uuid[0,6]
end

#decode_b381b571_1ab2_5889_8221_855dbbc76242(host_pid) ⇒ Object

TODO: support unknown pids (maybe instantiate RemotePid instance or ProxyPid or something)



99
100
101
# File 'lib/emrpc/util/codec.rb', line 99

def decode_b381b571_1ab2_5889_8221_855dbbc76242(host_pid)
  host_pid.find_pid(@uuid)
end

#inspectObject



103
104
105
# File 'lib/emrpc/util/codec.rb', line 103

def inspect
  "#<Pid::Marshallable:#{_uid}>"
end