uuid4 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8d571b3ef1ee645b4af870cb088dba4ff1f38a0
4
- data.tar.gz: 8317145274b63c7b287d9e80eb8b89612a54a623
3
+ metadata.gz: 04afeacbf9716f6236267562d81ccb58693c1827
4
+ data.tar.gz: 9b5c45bb13a50ddbca3ee27399c2c06eacd22585
5
5
  SHA512:
6
- metadata.gz: 614bcc998d23a801c0cb36bfe2ae499644f532d6aa0a6b6f32aa84b399caa9cab38f8b92215f8c78bf74bc8a1b387d8723428224cbad0cdd9f85c5dc5c579e46
7
- data.tar.gz: 8a1c30565a9814d814d9d64bd2ffc560187ca738ec93f8f3fa2e886bb8b8adeb8dd0774bb1f3b81fe3822a190a7f35870c5b81b80ffbc60af359fd66194ea5ba
6
+ metadata.gz: 248ccebc7c7931a19a9a8cacac65ad690b1476f93a13b236668d8b9bd08721f934fcf46d4c1d4ec9f7a79e4fbeef75f19e3ecd6fb21423b4c4d4361b03380921
7
+ data.tar.gz: 3448aab7d878a14040c4b5b8d564019733ca14f2932f49d91310b223d853998de4fc369af5311e8bf0e84009ef5fd10eb0d1a22b1ab77b09f5383069ab0586d1
@@ -105,7 +105,7 @@ class UUID4
105
105
  end
106
106
 
107
107
  def valid_int?(int)
108
- int.to_s(16) =~ Formatter::Compact::REGEXP
108
+ int.to_s(16).rjust(32, '0') =~ Formatter::Compact::REGEXP
109
109
  end
110
110
  end
111
111
  end
@@ -3,7 +3,7 @@ require 'base62-rb'
3
3
  class UUID4
4
4
  module Formatter
5
5
  class Base62
6
- REGEXP = /^[0-9A-z]{22}$/i
6
+ REGEXP = /^[0-9A-z]{14,22}$/i
7
7
 
8
8
  def encode(uuid)
9
9
  ::Base62.encode(uuid.to_i)
@@ -11,7 +11,9 @@ class UUID4
11
11
 
12
12
  def decode(value)
13
13
  if value.respond_to?(:to_str) && (value = value.to_str) =~ REGEXP
14
- ::Base62.decode(value)
14
+ if ::UUID4.valid_int?(int = ::Base62.decode(value))
15
+ int
16
+ end
15
17
  end
16
18
  end
17
19
  end
@@ -2,7 +2,7 @@ class UUID4
2
2
  module VERSION
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STAGE = nil
7
7
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uuid4
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen