uuid64 0.0.6 → 0.0.7

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 +9 -0
  3. metadata +19 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7964baa001a49cec98feb866592759e676dc8b9
4
- data.tar.gz: 5d4e5e176bf22b9ea57d9d480578e2061cec010e
3
+ metadata.gz: ee14503a042bf7aa3d93100defd12f45adbb3b3d
4
+ data.tar.gz: f64bfee58d1c6878c19b3648b92edd1885591c17
5
5
  SHA512:
6
- metadata.gz: 4ce41d1a2fa3eea9f33353a965f8b3ab120a75f586c090ea1475b20d5efd3a866bb0a023b37fe010097b64bc22cd5af94d82b660383e97d712144d3f40df2c27
7
- data.tar.gz: 3d53b0a9461c305f8442d8067058b1520c15d07fede586a060545a42c030c5270b703f0f58258dcae657d0751a91b285d9a9e9b635676e0eaabf052d639c7906
6
+ metadata.gz: d7a8cfc9a47f3d9288b9afe8b1a57abc4024945477f2b5534fd846179d70e0164c688da2f88e6a59d80ec3c6be90d46dfce7da61f34202fccc2e852e42d262f5
7
+ data.tar.gz: b66d92ed7d534ad92232b0c84d675f4f07bf30b5b3490cb38eada4847f2dc70481bb932dbdfe21f2cc7cb1d2fa14074dfe94e749f934cd83e77969774140c9ad
@@ -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.6
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-05-11 00:00:00.000000000 Z
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: business@heckpsi.com
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.6.1
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: