uuid64 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/uuid64.rb +3 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e51a87b3e3458b866e31da23ca03adde3007d1d
4
- data.tar.gz: 7392e46d020b374d2f3817b8fca2a5015041eb57
3
+ metadata.gz: 0db5b0370b178cb6a720af42dbdd51364b15d392
4
+ data.tar.gz: 8b52c1e6b8280b0ddd2b9470bbebe7aa83d02d4c
5
5
  SHA512:
6
- metadata.gz: 9afc0334f6a5873692c9de09fba3a703f12d117d21db3c77fa25949f691cd6c3a6f1bae6fef28d5f948cd5b52887d2647bad8be9e1ab5ca8b2ab0f65f56ad445
7
- data.tar.gz: eb1be3e8bd804caf49d0a76f61be78f2cb702de3f8353e5508d4bef7e8f1cde8fd3d7fad115f6e152d4c6f58c0f6ab0de6d62099618d0e677caf7921bc10109e
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.gsub(/-/, '')].pack('H*')].pack('m').gsub(/==/,'').gsub(/\n/,'')
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').gsub(/\n/,'')
28
+ [[SecureRandom.mongo_id].pack('H*')].pack('m').chomp
28
29
  end
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuid64
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - HeckPsi Lab