Class: Neo4j::Driver::Summary::ServerInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/summary/server_info.rb

Overview

Server metadata reported in the SUCCESS response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_data = nil, address: nil, agent: nil, protocol_version: nil) ⇒ ServerInfo

Returns a new instance of ServerInfo.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/neo4j/driver/summary/server_info.rb', line 10

def initialize(server_data = nil, address: nil, agent: nil, protocol_version: nil)
  case server_data
  when String
    @agent = server_data
    @address = address
    @protocol_version = protocol_version
  when Hash
    @address = server_data[:address] || address
    @agent = server_data[:agent] || agent
    @protocol_version = server_data[:protocol_version] || protocol_version
  else
    @address = address
    @agent = agent
    @protocol_version = protocol_version
  end
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



8
9
10
# File 'lib/neo4j/driver/summary/server_info.rb', line 8

def address
  @address
end

#agentObject (readonly)

Returns the value of attribute agent.



8
9
10
# File 'lib/neo4j/driver/summary/server_info.rb', line 8

def agent
  @agent
end

#protocol_versionObject (readonly)

Returns the value of attribute protocol_version.



8
9
10
# File 'lib/neo4j/driver/summary/server_info.rb', line 8

def protocol_version
  @protocol_version
end

Instance Method Details

#to_sObject



27
28
29
# File 'lib/neo4j/driver/summary/server_info.rb', line 27

def to_s
  @agent || 'Unknown'
end