uuid64 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uuid64.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0db5b0370b178cb6a720af42dbdd51364b15d392
|
4
|
+
data.tar.gz: 8b52c1e6b8280b0ddd2b9470bbebe7aa83d02d4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e81beee389490d8af8879e190445e7f9f1d3e65fb63a7b28d8dd5ddae2768b3481a1028948e0a54e402280f42336cda9525448c7710183737ac84ffc75be2019
|
7
|
+
data.tar.gz: 125d123e04092eefff4e27584e49a6d7e4036ee8a13d8dd1e28b6c86d2fc5cbe9bc6ce9e40c272c16243c4e48d24e6eb1e37458a72f4d12f170536251493cbe4
|
data/lib/uuid64.rb
CHANGED
@@ -4,7 +4,7 @@ require 'digest'
|
|
4
4
|
|
5
5
|
module SecureRandom
|
6
6
|
def self.uuid64
|
7
|
-
[[SecureRandom.uuid.
|
7
|
+
[[SecureRandom.uuid.delete('-')].pack('H*')].pack('m').delete('=').chomp
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.mongo_id
|
@@ -15,6 +15,7 @@ module SecureRandom
|
|
15
15
|
@mongo_inc = 0
|
16
16
|
else
|
17
17
|
@mongo_inc += 1
|
18
|
+
@mongo_inc = 0 if @mongo_inc > 16777215
|
18
19
|
end
|
19
20
|
|
20
21
|
Time.now.to_i.to_s(16)[0..15].rjust(8, '0')[0..7] +
|
@@ -24,6 +25,6 @@ module SecureRandom
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def self.mongo_id64
|
27
|
-
[[SecureRandom.mongo_id].pack('H*')].pack('m').
|
28
|
+
[[SecureRandom.mongo_id].pack('H*')].pack('m').chomp
|
28
29
|
end
|
29
30
|
end
|