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 load
      if File.exist?(@file)
        raw = CSV.read(@file).map do |row|
          {
            host: row[0],
            port: row[1].to_i,
            score: row[2].to_i,
            errors: row[3].to_i,
            master: master?(row[0], row[1].to_i)
          }
        end
        raw.reject { |r| !r[:host] || r[:port].zero? || r[:host] == '0.0.0.0' }.map do |r|
          r[:home] = URI("http://#{r[:host]}:#{r[:port]}/")
          r
        end
      else
        []
      end
    end
def load if File . exist? ( @file ) raw = CSV . read ( @file ) . map do | row | { host : row [ 0 ] , port : row [ 1 ] . to_i , score : row [ 2 ] . to_i , errors : row [ 3 ] . to_i , master : master? ( row [ 0 ] , row [ 1 ] . to_i ) } end raw . reject { | r | ! r [ :host ] || r [ :port ] . zero? || r [ :host ] == '0.0.0.0' } . map do | r | r [ :home ] = URI ( "http://#{r[:host]}:#{r[:port]}/" ) r end else [ ] end end
The default TCP port all nodes are supposed to use.
The default TCP port all nodes are supposed to use .