active_uxid 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_uxid/ulid.rb +4 -2
- data/lib/active_uxid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f268252b89f510be74aee33cf4f05c3c7d42ed92
|
4
|
+
data.tar.gz: 41a5e44b636ec6d8c93e9fe6a19228ecde6dc8f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 788be6648a7c161283f8296be871f09e4928990f9543dc90190f9998b068ae32aa897fc318e749165c6dd64282cdcf13751508fd52e54bd8ff4ff0c15482f357
|
7
|
+
data.tar.gz: 1696f6915cb835be739f48c56bdf1a092669707270993438b075dafbbee6b00b50d4cfc6a01cf9ecab67e50d4c36a25d64f2b8b63f7ae6f64cd25469e9b8b180
|
data/lib/active_uxid/ulid.rb
CHANGED
@@ -6,7 +6,9 @@ module ActiveUxid
|
|
6
6
|
ENCODING_CHARS ||= ActiveUxid.configuration.encoding_chars
|
7
7
|
ENCODING_LENGTH = ActiveUxid.configuration.encoding_length
|
8
8
|
|
9
|
-
def initialize
|
9
|
+
def initialize
|
10
|
+
@encoding_length = ActiveUxid.configuration.encoding_length
|
11
|
+
end
|
10
12
|
|
11
13
|
def self.encode
|
12
14
|
klass = new
|
@@ -14,7 +16,7 @@ module ActiveUxid
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def uxid_encode
|
17
|
-
(1
|
19
|
+
(1..@encoding_length).reduce('') do |str, num|
|
18
20
|
shift = 128 - 5 * num
|
19
21
|
"#{str}#{ENCODING_CHARS[(uxid_octect >> shift) & 0x1f]}"
|
20
22
|
end
|
data/lib/active_uxid/version.rb
CHANGED