torid 1.2.5 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d0da570c2c29c82c9d84eab0cbe7ac54d06b93ab
4
- data.tar.gz: 9591855e86a26a2bb4b4fccabb2eb6634458d24a
3
+ metadata.gz: 7d20a674ba49b2280a1982ee32d19596f4b1e858
4
+ data.tar.gz: 51ea825a845aad31211d9539dce7ef469b2038a2
5
5
  SHA512:
6
- metadata.gz: 391dc11121db582d33006813d122399b0f87af25d04303f41b69acb6c96e935dbe0519a45fc43738ff1e1cca96e98ea7b10e69b03e80aecd14962f831a56101c
7
- data.tar.gz: b873a05612e445626b58a81c474ae3d1c8c6f5ab051e6ddac5524be81d4dc8dfed8c1dc4b0e790a5b32dbed83c4598cebd0766cfaf04bab3e24376ab8bdc889c
6
+ metadata.gz: fd73c0676c08a61b0148e4fc57c84c62d9ec82d2ec2e27d1e20917bc5331c5f9a3024d671d9676dacdd9f45bd252427183c729f7a361994f3b95d7eb156b6096
7
+ data.tar.gz: 1dce7633ba85aef60e7303a013ddf0cb7c44165716f72c1b732b510cdcbb6f48f97f1be2cabe33f9cad9a772e285684e7451d4bba3a6612ce3a8fe2b16fefbe9
data/HISTORY.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # Torid Changelog
2
+ ## Version 1.3.0 - 2017-02-17
3
+
4
+ * Add Torid::UUID#node_id_s to allow access to just the node portion
5
+ of the UUID as a string.
6
+
2
7
  ## Version 1.2.4 - 2015-02-18
3
8
 
4
9
  * Fix a failing test case on jruby. Only affected running tests.
@@ -2,7 +2,7 @@
2
2
  # that sort lexically in time order.
3
3
  module Torid
4
4
  # Public: The Version of the Torid library as a String
5
- VERSION = "1.2.5"
5
+ VERSION = "1.3.0"
6
6
 
7
7
  # Public: return the next Torid::UUID from the default Generator
8
8
  #
@@ -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
@@ -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.2.5
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: 2016-12-01 00:00:00.000000000 Z
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.4
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