Method: Aerospike::Peers::Parse.parse_peer

Defined in:
lib/aerospike/peers/parse.rb

.parse_peer(parser, obj) ⇒ Object

[View source]

60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/aerospike/peers/parse.rb', line 60

def parse_peer(parser, obj)
  ::Aerospike::Peer.new.tap do |peer|
    parser.expect('[')
    peer.node_name = parser.read_until(',')
    peer.tls_name = parser.read_until(',')
    peer.hosts = parse_hosts(parser, peer)
    # Assign default port if missing
    peer.hosts.each do |host|
      host.port ||= obj.port_default
    end
    parser.expect(']')
  end
end