Class: EMRPC::EventedWrapper

Inherits:
Object
  • Object
show all
Includes:
Pid
Defined in:
lib/emrpc/evented_api/evented_wrapper.rb

Constant Summary

Constants included from ProtocolMapper

ProtocolMapper::MAP

Instance Attribute Summary collapse

Attributes included from Pid

#_bind_address, #_em_server_signature, #_protocol, #connections, #killed, #options, #uuid

Instance Method Summary collapse

Methods included from Pid

#==, #_send_dirty, #_uid, #bind, #connect, #connection_established, #connection_unbind, #connection_uuids, #disconnect, #encode_b381b571_1ab2_5889_8221_855dbbc76242, #find_pid, #inspect, #kill, #killed?, #marshal_dump, #marshal_load, new, #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(options = {}) ⇒ EventedWrapper

Returns a new instance of EventedWrapper.



7
8
9
10
# File 'lib/emrpc/evented_api/evented_wrapper.rb', line 7

def initialize(options = {})
  super
  @backend = options[:backend] or raise ":backend option is missing!"
end

Instance Attribute Details

#backendObject

Returns the value of attribute backend.



5
6
7
# File 'lib/emrpc/evented_api/evented_wrapper.rb', line 5

def backend
  @backend
end

Instance Method Details

#pid_class_nameObject



23
24
25
# File 'lib/emrpc/evented_api/evented_wrapper.rb', line 23

def pid_class_name
  "EventedWrapper"
end

#send(from, msg, *args) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/emrpc/evented_api/evented_wrapper.rb', line 12

def send(from, msg, *args)
  #p [self, :send, {:from => from, :msg => msg, :args => args}]
  begin
    r = @backend.send(msg, *args)
    #p ["EventedWrapper returns", {:from => from, :send => [:on_return, self, r]}]
    from.send(:on_return, self, r)
  rescue => e
    from.send(:on_raise, self, e)
  end
end