Class: Neo4j::Driver::Net::ServerAddress
- Inherits:
-
Data
- Object
- Data
- Neo4j::Driver::Net::ServerAddress
- Defined in:
- lib/neo4j/driver/net.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
-
#to_s ⇒ Object
"host:port" (IPv6 hosts bracketed) — matches Java's ServerAddress.toString and Routing::ServerAddress#to_s.
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host
9 10 11 |
# File 'lib/neo4j/driver/net.rb', line 9 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port
9 10 11 |
# File 'lib/neo4j/driver/net.rb', line 9 def port @port end |
Class Method Details
.of(host, port) ⇒ Object
10 11 12 |
# File 'lib/neo4j/driver/net.rb', line 10 def self.of(host, port) new(host, port) end |
Instance Method Details
#to_s ⇒ Object
"host:port" (IPv6 hosts bracketed) — matches Java's
ServerAddress.toString and Routing::ServerAddress#to_s. Without
this, the default Data inspect (#<data … host="h", port=N>)
leaks anywhere a caller stringifies the address: a custom
resolver returns Net::ServerAddress values and
Bolt::Connection#split_addr does addr.to_s.rpartition(":"),
which then split on the :: inside the class name and fed the
tail to Integer() — the ArgumentError across the v4x4/v5x0
resolver routing tests.
23 24 25 |
# File 'lib/neo4j/driver/net.rb', line 23 def to_s host.include?(':') && !host.start_with?('[') ? "[#{host}]:#{port}" : "#{host}:#{port}" end |