module PipeRpc class Hub::Servers def initialize @servers = Hash.new{ |hash, key| raise NoServerError.new("no server #{key}") } end def add(*servers) if servers.first.respond_to? :to_rpc_server_id servers.each{ |server| @servers[server.to_rpc_server_id] = server } else servers.first.each{ |id, server| @servers[id.to_sym] = 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