lib/zold/remotes.rb
# The default TCP port all nodes are supposed to use.
The default TCP port all nodes are supposed to use.
The default TCP port all nodes are supposed to use .
def add(host, port = Remotes::PORT)
      raise 'Host can\'t be nil' if host.nil?
      raise 'Host can\'t be empty' if host.empty?
      raise 'Port can\'t be nil' if port.nil?
      raise 'Port has to be of type Integer' unless port.is_a?(Integer)
      raise 'Port can\'t be zero' if port.zero?
      raise 'Port can\'t be negative' if port < 0
      raise 'Port can\'t be over 65536' if port > 0xffff
      raise "#{host}:#{port} already exists" if exists?(host, port)
      list = load
      list << { host: host.downcase, port: port, score: 0 }
      list.uniq! { |r| "#{r[:host]}:#{r[:port]}" }
      save(list)
    end
def add ( host , port = Remotes :: PORT ) raise 'Host can\'t be nil' if host . nil? raise 'Host can\'t be empty' if host . empty? raise 'Port can\'t be nil' if port . nil? raise 'Port has to be of type Integer' unless port . is_a? ( Integer ) raise 'Port can\'t be zero' if port . zero? raise 'Port can\'t be negative' if port < 0 raise 'Port can\'t be over 65536' if port > 0xffff raise "#{host}:#{port} already exists" if exists? ( host , port ) list = load list << { host : host . downcase , port : port , score : 0 } list . uniq! { | r | "#{r[:host]}:#{r[:port]}" } save ( list ) end
The default TCP port all nodes are supposed to use.
The default TCP port all nodes are supposed to use .
host
<not_specific>
port
<not_specific>