lib/pipe_rpc/server.rb in pipe_rpc-2.4.0 vs lib/pipe_rpc/server.rb in pipe_rpc-2.5.0
- old
+ new
@@ -7,21 +7,31 @@
def __rpc_server_class_name__
__class__.to_s
end
+ def __rpc_server_instance_id__
+ __id__.to_s
+ end
+
def __rpc_server_id__
- "#{__rpc_server_class_name__}##{__id__}".to_sym
+ @__rpc_server_id__ ||= [__rpc_server_class_name__, *__rpc_server_instance_id__].join('#').to_sym
end
- def to_rpc_transport(hub)
- hub.servers.add(self) unless hub.servers.registered? __rpc_server_id__
+ def inspect
+ __rpc_server_id__
+ end
+ alias to_s inspect
+
+ def to_rpc_transport(gateway)
+ gateway.servers.add(self) unless gateway.servers.registered? __rpc_server_id__
"#{TRANSPORT_PREFIX}#{__rpc_server_id__}"
end
end
class << Server
- def instance_eval_for(server, *args, &block)
- Object.instance_method(:instance_eval).bind(server).call(*args, &block)
+ def from_rpc_transport(gateway, transport)
+ server = gateway.servers[transport.sub(Client::TRANSPORT_PREFIX, '').to_sym]
+ SubjectServer.from_rpc_transport(gateway, server)
end
end
end
\ No newline at end of file