Sha256: ffa71f91682f115a115e0ecd5ef11ffcd76d57f4c20d0a756618104f56f2e4dc
Contents?: true
Size: 827 Bytes
Versions: 1
Compression:
Stored size: 827 Bytes
Contents
module PipeRpc class Hub::Servers def initialize @servers = Hash.new{ |hash, key| raise NoServerError.new("no server #{key.inspect}") } end def add(server) id, server = if server.respond_to? :__rpc_server_id__ [server.__rpc_server_id__, server] else server.first end raise ServerRegistrationError.new("server id #{id.inspect} no symbol") unless id.is_a? Symbol if registered? id raise ServerRegistrationError.new("server id #{id.inspect} already used for another server") else @servers[id] = server end end def registered?(id) @servers.has_key?(id) end def registered_ids @servers.keys end def [](id) @servers[id] end def remove(id) @servers.delete(id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pipe_rpc-2.4.0 | lib/pipe_rpc/hub_servers.rb |