Class: EMRPC::RemotePid
- Includes:
- Pid
- Defined in:
- lib/emrpc/evented_api/remote_pid.rb
Overview
RemotePid is an interface for the actual remote pid.
Constant Summary
Constants included from ProtocolMapper
Instance Attribute Summary collapse
-
#_connection ⇒ Object
Returns the value of attribute _connection.
Attributes included from Pid
#_bind_address, #_em_server_signature, #_protocol, #connections, #killed, #options, #uuid
Instance Method Summary collapse
-
#initialize(conn, options) ⇒ RemotePid
constructor
A new instance of RemotePid.
- #inspect ⇒ Object
- #kill ⇒ Object
- #method_missing(*args) ⇒ Object
- #send(*args) ⇒ Object
Methods included from Pid
#==, #_send_dirty, #_uid, #bind, #connect, #connection_established, #connection_unbind, #connection_uuids, #disconnect, #encode_b381b571_1ab2_5889_8221_855dbbc76242, #find_pid, #killed?, #marshal_dump, #marshal_load, new, #pid_class_name, #spawn, #tcp_spawn, #thread_spawn
Methods included from DebugPidCallbacks
#_debug, #connected, #connection_failed, #disconnected, #handshake_failed, #on_raise, #on_return
Methods included from ProtocolMapper
#make_client_connection, #make_server_connection, register_protocol
Methods included from DefaultCallbacks
#connected, #connection_failed, #disconnected, #handshake_failed, #on_raise, #on_return
Constructor Details
#initialize(conn, options) ⇒ RemotePid
Returns a new instance of RemotePid.
7 8 9 10 11 12 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 7 def initialize(conn, ) _common_init @_connection = conn @uuid = [:uuid] @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
14 15 16 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 14 def method_missing(*args) send(*args) end |
Instance Attribute Details
#_connection ⇒ Object
Returns the value of attribute _connection.
5 6 7 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 5 def _connection @_connection end |
Instance Method Details
#inspect ⇒ Object
32 33 34 35 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 32 def inspect return "#<RemotePid:#{_uid} KILLED>" if @killed "#<RemotePid:#{_uid} on #{@_connection.address} connected with local pid #{@_connection.local_pid._uid}>" end |
#kill ⇒ Object
28 29 30 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 28 def kill send(:kill) end |
#send(*args) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/emrpc/evented_api/remote_pid.rb', line 18 def send(*args) cmd = args.first if cmd == :kill return if @killed @killed = true @_connection.close_connection_after_writing end @_connection.(args) end |