uxid 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/CHANGELOG.md +6 -0
- data/lib/uxid.rb +1 -2
- data/lib/uxid/encoder.rb +0 -20
- data/lib/uxid/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83f5ad9c6d24fca5ceca515470498dd1b7f00287773d559fa34ecade212d410
|
4
|
+
data.tar.gz: dbd2ba5aff3d1a292520936d129c6a0836de068404217c4017b90953c16c2d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f98601f4272844dfcae47636aac3fdbaa1616e018836d7ff5c3d555659dd958da8eeb3a816a12bbdb9dde2daea2cba323f30db21a4defa3bd917d45e8b854d
|
7
|
+
data.tar.gz: 79140ad04cc7e91983f7c9469f606e603959d393ba5751297efee2a7c6cfe85f5d855e1a71dd10bd561fc254629c1d10b39c90b8de663c58365f27001d851678
|
data/CHANGELOG.md
CHANGED
data/lib/uxid.rb
CHANGED
@@ -32,11 +32,11 @@ WARN: The UXID :size param is for Symbol T-Shirt sizes only.
|
|
32
32
|
|
33
33
|
model.time = attrs[:time] || Time.now
|
34
34
|
model.prefix = attrs[:prefix] || ""
|
35
|
+
model.size = attrs[:size]
|
35
36
|
|
36
37
|
if attrs[:rand_size]
|
37
38
|
model.rand_size = attrs[:rand_size]
|
38
39
|
else
|
39
|
-
model.size = attrs[:size]
|
40
40
|
case model.size
|
41
41
|
when Integer
|
42
42
|
puts SIZE_WARNING_MESSAGE
|
@@ -61,7 +61,6 @@ WARN: The UXID :size param is for Symbol T-Shirt sizes only.
|
|
61
61
|
else
|
62
62
|
model.rand_size = 10
|
63
63
|
end
|
64
|
-
|
65
64
|
end
|
66
65
|
|
67
66
|
model
|
data/lib/uxid/encoder.rb
CHANGED
@@ -27,8 +27,6 @@ module UXID
|
|
27
27
|
def encode_entropy_2
|
28
28
|
b0, b1 = @model.entropy_bytes
|
29
29
|
|
30
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
31
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
32
30
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
33
31
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
34
32
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -38,8 +36,6 @@ module UXID
|
|
38
36
|
def encode_entropy_3
|
39
37
|
b0, b1, b2 = @model.entropy_bytes
|
40
38
|
|
41
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
42
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
43
39
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
44
40
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
45
41
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -50,8 +46,6 @@ module UXID
|
|
50
46
|
def encode_entropy_4
|
51
47
|
b0, b1, b2, b3 = @model.entropy_bytes
|
52
48
|
|
53
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
54
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
55
49
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
56
50
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
57
51
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -64,8 +58,6 @@ module UXID
|
|
64
58
|
def encode_entropy_5
|
65
59
|
b0, b1, b2, b3, b4 = @model.entropy_bytes
|
66
60
|
|
67
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
68
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
69
61
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
70
62
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
71
63
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -79,8 +71,6 @@ module UXID
|
|
79
71
|
def encode_entropy_6
|
80
72
|
b0, b1, b2, b3, b4, b5 = @model.entropy_bytes
|
81
73
|
|
82
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
83
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
84
74
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
85
75
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
86
76
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -96,8 +86,6 @@ module UXID
|
|
96
86
|
def encode_entropy_7
|
97
87
|
b0, b1, b2, b3, b4, b5, b6 = @model.entropy_bytes
|
98
88
|
|
99
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
100
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
101
89
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
102
90
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
103
91
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -115,8 +103,6 @@ module UXID
|
|
115
103
|
def encode_entropy_8
|
116
104
|
b0, b1, b2, b3, b4, b5, b6, b7 = @model.entropy_bytes
|
117
105
|
|
118
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
119
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
120
106
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
121
107
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
122
108
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -135,8 +121,6 @@ module UXID
|
|
135
121
|
def encode_entropy_9
|
136
122
|
b0, b1, b2, b3, b4, b5, b6, b7, b8 = @model.entropy_bytes
|
137
123
|
|
138
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
139
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
140
124
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
141
125
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
142
126
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -149,7 +133,6 @@ module UXID
|
|
149
133
|
UXID::CROCKFORD_ENCODING[((b5&7)<<2) | ((b6&192)>>6)] +
|
150
134
|
UXID::CROCKFORD_ENCODING[(b6&62)>>1] +
|
151
135
|
UXID::CROCKFORD_ENCODING[((b6&1)<<4) | ((b7&240)>>4)] +
|
152
|
-
UXID::CROCKFORD_ENCODING[((b7&15)<<1)] +
|
153
136
|
UXID::CROCKFORD_ENCODING[((b7&15)<<1) | ((b8&128)>>7)] +
|
154
137
|
UXID::CROCKFORD_ENCODING[(b8&124)>>2] +
|
155
138
|
UXID::CROCKFORD_ENCODING[((b8&3)<<3)]
|
@@ -158,8 +141,6 @@ module UXID
|
|
158
141
|
def encode_entropy_10
|
159
142
|
b0, b1, b2, b3, b4, b5, b6, b7, b8, b9 = @model.entropy_bytes
|
160
143
|
|
161
|
-
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
162
|
-
UXID::CROCKFORD_ENCODING[((b0&7)<<2)] +
|
163
144
|
UXID::CROCKFORD_ENCODING[(b0&248)>>3] +
|
164
145
|
UXID::CROCKFORD_ENCODING[((b0&7)<<2) | ((b1&192)>>6)] +
|
165
146
|
UXID::CROCKFORD_ENCODING[(b1&62)>>1] +
|
@@ -172,7 +153,6 @@ module UXID
|
|
172
153
|
UXID::CROCKFORD_ENCODING[((b5&7)<<2) | ((b6&192)>>6)] +
|
173
154
|
UXID::CROCKFORD_ENCODING[(b6&62)>>1] +
|
174
155
|
UXID::CROCKFORD_ENCODING[((b6&1)<<4) | ((b7&240)>>4)] +
|
175
|
-
UXID::CROCKFORD_ENCODING[((b7&15)<<1)] +
|
176
156
|
UXID::CROCKFORD_ENCODING[((b7&15)<<1) | ((b8&128)>>7)] +
|
177
157
|
UXID::CROCKFORD_ENCODING[(b8&124)>>2] +
|
178
158
|
UXID::CROCKFORD_ENCODING[((b8&3)<<3) | ((b9&224)>>5)] +
|
data/lib/uxid/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uxid
|
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
|
- JohnnyT
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Generates IDs like: cus_01EPEY1JMKXVBT and txn_01EPEY2P06TR1RTV07XA82ZGJJ
|
14
14
|
(similar to Stripe identifiers).'
|