Class: Neo4j::Driver::Bolt::BoltVersion
- Inherits:
-
Object
- Object
- Neo4j::Driver::Bolt::BoltVersion
- Includes:
- Comparable
- Defined in:
- lib/neo4j/driver/bolt/bolt_version.rb
Overview
Represents a Bolt protocol version
Constant Summary collapse
- V3_0 =
Known Bolt versions
new(3, 0)
- V4_0 =
new(4, 0)
- V4_1 =
new(4, 1)
- V4_2 =
new(4, 2)
- V4_3 =
new(4, 3)
- V4_4 =
new(4, 4)
- V5_0 =
new(5, 0)
- V5_1 =
new(5, 1)
- V5_2 =
new(5, 2)
- V5_3 =
new(5, 3)
- V5_4 =
new(5, 4)
- V5_5 =
new(5, 5)
- V5_6 =
new(5, 6)
- V5_7 =
new(5, 7)
- V5_8 =
new(5, 8)
- V6_0 =
new(6, 0)
- V6_1 =
new(6, 1)
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
Class Method Summary collapse
-
.from_int(version_int) ⇒ Object
Server agreement is a 32-bit big-endian: [reserved, 0, minor, major].
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
Comparable wires the rest (<, >, <=, >=, ==, between?, clamp) off this one method.
-
#initialize(major, minor = 0) ⇒ BoltVersion
constructor
A new instance of BoltVersion.
- #to_i ⇒ Object
- #to_s ⇒ Object
-
#to_wire ⇒ Object
Wire encoding used by the Bolt handshake: 4 bytes big-endian, [reserved=0, range=0, minor, major].
Constructor Details
#initialize(major, minor = 0) ⇒ BoltVersion
Returns a new instance of BoltVersion.
12 13 14 15 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 12 def initialize(major, minor = 0) @major = major @minor = minor end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
10 11 12 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 10 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
10 11 12 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 10 def minor @minor end |
Class Method Details
.from_int(version_int) ⇒ Object
Server agreement is a 32-bit big-endian: [reserved, 0, minor, major]. So the low byte is major, the next-lowest is minor.
61 62 63 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 61 def self.from_int(version_int) new(version_int & 0xFF, (version_int >> 8) & 0xFF) end |
Instance Method Details
#<=>(other) ⇒ Object
Comparable wires the rest (<, >, <=, >=, ==, between?, clamp) off this one method.
36 37 38 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 36 def <=>(other) to_i <=> other.to_i end |
#to_i ⇒ Object
17 18 19 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 17 def to_i (@major << 8) | @minor end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 30 def to_s "#{@major}.#{@minor}" end |
#to_wire ⇒ Object
Wire encoding used by the Bolt handshake: 4 bytes big-endian, [reserved=0, range=0, minor, major]. So 5.7 is 0x00_00_07_05. NOT the same byte order as #to_i (which keeps major in the high byte so Comparable stays sane across major bumps).
26 27 28 |
# File 'lib/neo4j/driver/bolt/bolt_version.rb', line 26 def to_wire (@minor << 8) | @major end |