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