torid 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.md +5 -0
- data/lib/torid.rb +1 -1
- data/lib/torid/uuid.rb +10 -0
- data/test/test_uuid.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d20a674ba49b2280a1982ee32d19596f4b1e858
|
4
|
+
data.tar.gz: 51ea825a845aad31211d9539dce7ef469b2038a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd73c0676c08a61b0148e4fc57c84c62d9ec82d2ec2e27d1e20917bc5331c5f9a3024d671d9676dacdd9f45bd252427183c729f7a361994f3b95d7eb156b6096
|
7
|
+
data.tar.gz: 1dce7633ba85aef60e7303a013ddf0cb7c44165716f72c1b732b510cdcbb6f48f97f1be2cabe33f9cad9a772e285684e7451d4bba3a6612ce3a8fe2b16fefbe9
|
data/HISTORY.md
CHANGED
data/lib/torid.rb
CHANGED
data/lib/torid/uuid.rb
CHANGED
@@ -151,6 +151,16 @@ module Torid
|
|
151
151
|
"%08x-%04x-%04x-%02x%02x-%s" % elements
|
152
152
|
end
|
153
153
|
|
154
|
+
# Public: Return the hexidcimal UUID string representation of just the
|
155
|
+
# node_id. This is just the last 2 parts
|
156
|
+
def node_id_s
|
157
|
+
node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack("NN")
|
158
|
+
elements = node_bytes.unpack("CCa6")
|
159
|
+
node = elements[-1].unpack('C*')
|
160
|
+
elements[-1] = '%02x%02x%02x%02x%02x%02x' % node
|
161
|
+
"%02x%02x-%s" % elements
|
162
|
+
end
|
163
|
+
|
154
164
|
# Public: Compare the equality of UUID's
|
155
165
|
#
|
156
166
|
# Examples
|
data/test/test_uuid.rb
CHANGED
@@ -10,6 +10,7 @@ module Torid
|
|
10
10
|
@bytes = [ @timestamp >> 32, @timestamp & 0xFFFF_FFFF,
|
11
11
|
@node_id >> 32, @node_id & 0XFFFF_FFFF ].pack("NNNN")
|
12
12
|
@guid = "0004fd7d-f50d-e22e-0000-00000000002a"
|
13
|
+
@node_id_s = "0000-00000000002a"
|
13
14
|
end
|
14
15
|
|
15
16
|
def test_uuid_regex_matches
|
@@ -49,6 +50,11 @@ module Torid
|
|
49
50
|
assert_equal( @node_id , uuid.node_id )
|
50
51
|
end
|
51
52
|
|
53
|
+
def test_extracts_node_id_as_hex
|
54
|
+
uuid = ::Torid::UUID.from( @bytes)
|
55
|
+
assert_equal( @node_id_s, uuid.node_id_s )
|
56
|
+
end
|
57
|
+
|
52
58
|
def test_round_trips_uuid_string
|
53
59
|
uuid = ::Torid::UUID.from( @guid )
|
54
60
|
assert_equal( uuid.to_s, uuid.to_s )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: torid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Hinegardner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fnv
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.6.
|
144
|
+
rubygems_version: 2.6.10
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Temporally Ordered IDs. Generate universally unique identifiers (UUID) that
|