Module: Rubarb::IncomingConnection

Includes:
RemoteCall
Defined in:
lib/rubarb/incoming_connection.rb

Instance Method Summary collapse

Methods included from RemoteCall

#marshal_call, #unmarshal_call

Instance Method Details

#receive_message(message) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/rubarb/incoming_connection.rb', line 10

def receive_message(message)
  id, method, args = unmarshal_call(message)
  responder = Responder.new(self, id)
  begin
    raise Rubarb::InsecureMethodCallError.new(method) if @insecure_methods.include?(method)
    api.send(method, *[responder, *args]);
  rescue Exception => e
    reply("0", e)
  end
end

#reply(id, *args) ⇒ Object



21
22
23
# File 'lib/rubarb/incoming_connection.rb', line 21

def reply(id, *args)
  send_message(marshal_call(args.unshift(id)))
end