active_uxid 1.0.6 → 1.0.7
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 -1
- 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: 5591852e4fc7ad73580cfc24f30e148b06414239
|
4
|
+
data.tar.gz: bb20521689e1c59c502b576c16e5791b96252d37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc06dfd7c88071a873ef3b1ee7a0dce5e1aff6dd2ca2f333b02b3d475fdeeada8d1889a015a5840b0f631145908e3dd6145f4cdecc92d07e4560b75d3ecfcff7
|
7
|
+
data.tar.gz: e7c235a3943aedf6ed806460441bc716bbcc6c735dba1d07a9b61a2c64c0c5902f24acc2cb6c1c90aa4d6126b9927f3e6faa195daa0f67e178a373a0b45dae92
|
data/lib/active_uxid/ulid.rb
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
module ActiveUxid
|
4
4
|
class Ulid < ActiveUxid::Base
|
5
5
|
|
6
|
+
ENCODING_CHARS ||= ActiveUxid.configuration.encoding_chars
|
7
|
+
ENCODING_LENGTH ||= ActiveUxid.configuration.encoding_length
|
8
|
+
|
6
9
|
def initialize; end
|
7
10
|
|
8
11
|
def self.encode
|
@@ -11,7 +14,7 @@ module ActiveUxid
|
|
11
14
|
end
|
12
15
|
|
13
16
|
def uxid_encode
|
14
|
-
(1..
|
17
|
+
(1..ENCODING_LENGTH).reduce('') do |str, num|
|
15
18
|
shift = 128 - 5 * num
|
16
19
|
"#{str}#{ENCODING_CHARS[(uxid_octect >> shift) & 0x1f]}"
|
17
20
|
end
|
data/lib/active_uxid/version.rb
CHANGED