active_uxid 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9562a3022031637a6274b83a1e2314c06bb15376
4
- data.tar.gz: e9393cde490974f5929bd68ba32df0ef2b025dab
3
+ metadata.gz: 3d409ea9b9433696e7cb4854418fd0592c7e1c59
4
+ data.tar.gz: 38b9f9132f7cb8bc2d7725ad75b1c174ea2b2cc1
5
5
  SHA512:
6
- metadata.gz: bedd95ff15abb5b98db5a3539fef901f3584abe6434339e51ca0e8a9ca0a67f169e02bc7895baf0542d41b1b7c7dceff00ae0ab2bfb7a85221d54bb5d674660b
7
- data.tar.gz: 8f77b5888cf9f60e887ab4a20374b10a6cad55c5f823c4a253398534dfd0ef334db2d2f02706607a97e60fc3597aa196035eca1c8925b81c52b1b264e13234a3
6
+ metadata.gz: 1cccf014569967ae286cbe07e83325693c40ddfc97a42d31c3bdcaf6102e48f01c615f2518c456a7949348e0bf734f882f4a0937fd1360fea8910a5052d09838
7
+ data.tar.gz: dd1304d11f680895f984014ec891176b3a61941b898997405dd43bd0e4762174c63eb06602614691336731b281672a0faef5ba993c487ff1766f3a1fbb9dc470
@@ -3,10 +3,9 @@
3
3
  module ActiveUxid
4
4
  class Hash < ActiveUxid::Base
5
5
 
6
- ENCODING_BASE ||= ENCODING_CHARS.length
7
-
8
6
  def initialize(id)
9
7
  @id = id
8
+ super()
10
9
  end
11
10
 
12
11
  def self.encode(id)
@@ -20,11 +19,11 @@ module ActiveUxid
20
19
  end
21
20
 
22
21
  def encode_uxid
23
- uxid_encode_chars((@id + ENCODING_SALT) << ENCODING_LENGTH)
22
+ uxid_encode_chars((@id + encoding_salt) << encoding_length)
24
23
  end
25
24
 
26
25
  def decode_uxid
27
- (uxid_decode_chars(@id) >> ENCODING_LENGTH) - ENCODING_SALT
26
+ (uxid_decode_chars(@id) >> encoding_length) - encoding_salt
28
27
  end
29
28
 
30
29
  def uxid_encode_chars(id)
@@ -34,8 +33,8 @@ module ActiveUxid
34
33
  str = ''
35
34
 
36
35
  while id.positive?
37
- str = "#{ENCODING_CHARS[id % ENCODING_BASE]}#{str}"
38
- id /= ENCODING_BASE
36
+ str = "#{encoding_chars[id % encoding_base]}#{str}"
37
+ id /= encoding_base
39
38
  end
40
39
 
41
40
  str
@@ -48,8 +47,8 @@ module ActiveUxid
48
47
  max = len - 1
49
48
 
50
49
  while pos < len
51
- pow = ENCODING_BASE**(max - pos)
52
- num += ENCODING_CHARS.index(id[pos]) * pow
50
+ pow = encoding_base ** (max - pos)
51
+ num += encoding_chars.index(id[pos]) * pow
53
52
  pos += 1
54
53
  end
55
54
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRegulation
4
- VERSION ||= '1.0.11'
4
+ VERSION ||= '1.0.12'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_uxid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez