uuid64 0.0.6 → 0.0.7
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 +9 -0
- metadata +19 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee14503a042bf7aa3d93100defd12f45adbb3b3d
|
4
|
+
data.tar.gz: f64bfee58d1c6878c19b3648b92edd1885591c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a8cfc9a47f3d9288b9afe8b1a57abc4024945477f2b5534fd846179d70e0164c688da2f88e6a59d80ec3c6be90d46dfce7da61f34202fccc2e852e42d262f5
|
7
|
+
data.tar.gz: b66d92ed7d534ad92232b0c84d675f4f07bf30b5b3490cb38eada4847f2dc70481bb932dbdfe21f2cc7cb1d2fa14074dfe94e749f934cd83e77969774140c9ad
|
data/lib/uuid64.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'digest'
|
3
3
|
require 'socket'
|
4
4
|
require 'securerandom'
|
5
|
+
require 'base62'
|
5
6
|
|
6
7
|
module SecureRandom
|
7
8
|
class << self
|
@@ -9,6 +10,10 @@ module SecureRandom
|
|
9
10
|
[[uuid.delete('-')].pack('H*')].pack('m').delete('=').chomp
|
10
11
|
end
|
11
12
|
|
13
|
+
def uuid62
|
14
|
+
uuid.delete('-').to_i(16).base62_encode
|
15
|
+
end
|
16
|
+
|
12
17
|
def mongo_id
|
13
18
|
@mongo_host ||= Digest::SHA2.hexdigest(Socket.gethostname)[0..5].freeze
|
14
19
|
@mongo_pid ||= Process.pid.to_s(16)[0..3].rjust(4, '0').freeze
|
@@ -26,5 +31,9 @@ module SecureRandom
|
|
26
31
|
def mongo_id64
|
27
32
|
[[mongo_id].pack('H*')].pack('m').chomp
|
28
33
|
end
|
34
|
+
|
35
|
+
def mongo_id62
|
36
|
+
mongo_id.to_i(16).base62_encode
|
37
|
+
end
|
29
38
|
end
|
30
39
|
end
|
metadata
CHANGED
@@ -1,17 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uuid64
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HeckPsi Lab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-11-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: base62
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
13
27
|
description: This is a library generating unique id in short pattern.
|
14
|
-
email:
|
28
|
+
email: delton@heckpsi.com
|
15
29
|
executables: []
|
16
30
|
extensions: []
|
17
31
|
extra_rdoc_files: []
|
@@ -37,9 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
51
|
version: '0'
|
38
52
|
requirements: []
|
39
53
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.4.8
|
41
55
|
signing_key:
|
42
56
|
specification_version: 4
|
43
57
|
summary: This is a library generating unique id in short pattern.
|
44
58
|
test_files: []
|
45
|
-
has_rdoc:
|