Sha256: 5509dc7234dce1db551a284a4580ecffa01be8762b41ec3554ce6fde932510d4

Contents?: true

Size: 439 Bytes

Versions: 2

Compression:

Stored size: 439 Bytes

Contents

module PipeRpc
  class Hub::Servers
    def initialize
      @servers = Hash.new{ |hash, key| raise NoServerError.new("no server #{key}") }
    end

    def add(servers)
      servers.each{ |name, server| @servers[name.to_sym] = server }
    end

    def [](name)
      @servers[name.to_sym]
    end

    def remove(name)
      @servers.delete(name.to_sym)
    end

    def registered?(name)
      @servers.has_key?(name)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pipe_rpc-2.0.0 lib/pipe_rpc/hub_servers.rb
pipe_rpc-1.1.2 lib/pipe_rpc/hub_servers.rb