ruuid 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruuid/parser.rb +6 -9
- data/lib/ruuid/uuid.rb +2 -2
- data/lib/ruuid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc063c80e473ff458f809fb2e17f92d07e1e8672
|
4
|
+
data.tar.gz: 86d3077f97bb6807045b3a7e82ac64659900043c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16490a0acab29eaf6e142243d4a2564a0164341cb23310d12e129e68b0394924fcfb6a6e7cdbee96842d5ab8a88118380f8027a188d94e222abee50b7b90752e
|
7
|
+
data.tar.gz: 40a4b538637ae730e2c3e955a6cb37a4163f892b8090dbe4f15229222176ce0055e8626161cd4852d0d87599518b77bf98143214cdcfac6263684d4588973bb1
|
data/lib/ruuid/parser.rb
CHANGED
@@ -3,17 +3,14 @@ module RUUID
|
|
3
3
|
module Parser
|
4
4
|
extend self
|
5
5
|
|
6
|
-
|
6
|
+
FORMAT = /^\h{8}-?\h{4}-?\h{4}-?[89ab]\h{3}-?\h{12}$/i
|
7
7
|
|
8
8
|
def parse(string)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def sanitize(string)
|
16
|
-
string.gsub(BLACKLIST, '')
|
9
|
+
if string[FORMAT]
|
10
|
+
[string.gsub(/\H/, '')].pack('H*')
|
11
|
+
else
|
12
|
+
string
|
13
|
+
end
|
17
14
|
end
|
18
15
|
end # Parser
|
19
16
|
end # RUUID
|
data/lib/ruuid/uuid.rb
CHANGED
@@ -65,11 +65,11 @@ module RUUID
|
|
65
65
|
|
66
66
|
def validate
|
67
67
|
unless data.length == 16
|
68
|
-
raise InvalidUUIDError,
|
68
|
+
raise InvalidUUIDError, "Invalid UUID length: #{data.inspect}"
|
69
69
|
end
|
70
70
|
|
71
71
|
unless data.bytes[8] >> 6 == 2
|
72
|
-
raise InvalidUUIDError,
|
72
|
+
raise InvalidUUIDError, "Invalid UUID variant: #{data.inspect}"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
data/lib/ruuid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|