encoded_id 1.0.0.rc4 → 1.0.0.rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +9 -0
- data/.devcontainer/compose.yml +8 -0
- data/.devcontainer/devcontainer.json +8 -0
- data/.standard.yml +2 -0
- data/CHANGELOG.md +9 -2
- data/Gemfile +17 -5
- data/LICENSE.txt +1 -1
- data/README.md +50 -3
- data/Rakefile +8 -2
- data/ext/encoded_id/extconf.rb +3 -0
- data/ext/encoded_id/extension.c +123 -0
- data/ext/encoded_id/hashids.c +939 -0
- data/ext/encoded_id/hashids.h +139 -0
- data/lib/encoded_id/alphabet.rb +4 -0
- data/lib/encoded_id/hash_id.rb +227 -0
- data/lib/encoded_id/hash_id_consistent_shuffle.rb +27 -0
- data/lib/encoded_id/hash_id_salt.rb +15 -0
- data/lib/encoded_id/ordinal_alphabet_separator_guards.rb +90 -0
- data/lib/encoded_id/reversible_id.rb +3 -5
- data/lib/encoded_id/version.rb +1 -1
- data/lib/encoded_id.rb +8 -0
- data/sig/encoded_id.rbs +75 -3
- metadata +19 -24
- data/sig/hash_ids.rbs +0 -70
metadata
CHANGED
@@ -1,54 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: encoded_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Ierodiaconou
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: hashids
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.0'
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
27
12
|
description: Encode your numerical IDs (eg record primary keys) into obfuscated strings
|
28
13
|
that can be used in URLs. The obfuscated strings are reversible, so you can decode
|
29
14
|
them back into the original numerical IDs. Supports encoding multiple IDs at once,
|
30
15
|
and generating IDs with custom alphabets and separators to make the IDs easier to
|
31
|
-
read or share.
|
16
|
+
read or share. Dependency free.
|
32
17
|
email:
|
33
18
|
- stevegeek@gmail.com
|
34
19
|
executables: []
|
35
20
|
extensions: []
|
36
21
|
extra_rdoc_files: []
|
37
22
|
files:
|
23
|
+
- ".devcontainer/Dockerfile"
|
24
|
+
- ".devcontainer/compose.yml"
|
25
|
+
- ".devcontainer/devcontainer.json"
|
26
|
+
- ".standard.yml"
|
38
27
|
- CHANGELOG.md
|
39
28
|
- Gemfile
|
40
29
|
- LICENSE.txt
|
41
30
|
- README.md
|
42
31
|
- Rakefile
|
43
32
|
- Steepfile
|
33
|
+
- ext/encoded_id/extconf.rb
|
34
|
+
- ext/encoded_id/extension.c
|
35
|
+
- ext/encoded_id/hashids.c
|
36
|
+
- ext/encoded_id/hashids.h
|
44
37
|
- lib/encoded_id.rb
|
45
38
|
- lib/encoded_id/alphabet.rb
|
39
|
+
- lib/encoded_id/hash_id.rb
|
40
|
+
- lib/encoded_id/hash_id_consistent_shuffle.rb
|
41
|
+
- lib/encoded_id/hash_id_salt.rb
|
46
42
|
- lib/encoded_id/hex_representation.rb
|
43
|
+
- lib/encoded_id/ordinal_alphabet_separator_guards.rb
|
47
44
|
- lib/encoded_id/reversible_id.rb
|
48
45
|
- lib/encoded_id/version.rb
|
49
46
|
- rbs_collection.yaml
|
50
47
|
- sig/encoded_id.rbs
|
51
|
-
- sig/hash_ids.rbs
|
52
48
|
homepage: https://github.com/stevegeek/encoded_id
|
53
49
|
licenses:
|
54
50
|
- MIT
|
@@ -56,10 +52,10 @@ metadata:
|
|
56
52
|
homepage_uri: https://github.com/stevegeek/encoded_id
|
57
53
|
source_code_uri: https://github.com/stevegeek/encoded_id
|
58
54
|
changelog_uri: https://github.com/stevegeek/encoded_id/blob/master/CHANGELOG.md
|
59
|
-
post_install_message:
|
60
55
|
rdoc_options: []
|
61
56
|
require_paths:
|
62
57
|
- lib
|
58
|
+
- ext
|
63
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
60
|
requirements:
|
65
61
|
- - ">="
|
@@ -71,9 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
67
|
- !ruby/object:Gem::Version
|
72
68
|
version: '0'
|
73
69
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
70
|
+
rubygems_version: 3.6.7
|
76
71
|
specification_version: 4
|
77
72
|
summary: EncodedId is a gem for creating reversible obfuscated IDs from numerical
|
78
|
-
IDs. It uses Hash IDs under the hood.
|
73
|
+
IDs. It uses an implementation of Hash IDs under the hood.
|
79
74
|
test_files: []
|
data/sig/hash_ids.rbs
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
class Hashids
|
2
|
-
MIN_ALPHABET_LENGTH: ::Integer
|
3
|
-
|
4
|
-
SEP_DIV: ::Float
|
5
|
-
|
6
|
-
GUARD_DIV: ::Float
|
7
|
-
|
8
|
-
DEFAULT_SEPS: ::String
|
9
|
-
|
10
|
-
DEFAULT_ALPHABET: ::String
|
11
|
-
|
12
|
-
attr_reader salt: ::String
|
13
|
-
|
14
|
-
attr_reader min_hash_length: ::Integer
|
15
|
-
|
16
|
-
attr_reader alphabet: ::String
|
17
|
-
|
18
|
-
attr_reader seps: ::String
|
19
|
-
|
20
|
-
attr_reader guards: untyped
|
21
|
-
|
22
|
-
def initialize: (?::String salt, ?::Integer min_hash_length, ?untyped alphabet) -> void
|
23
|
-
|
24
|
-
def encode: (*(Array[::Integer] | ::Integer) numbers) -> ::String
|
25
|
-
|
26
|
-
def encode_hex: (::String str) -> ::String
|
27
|
-
|
28
|
-
def decode: (::String hash) -> ::Array[::Integer]
|
29
|
-
|
30
|
-
def decode_hex: (::String hash) -> ::Array[::Integer]
|
31
|
-
|
32
|
-
# protected
|
33
|
-
|
34
|
-
def internal_encode: (untyped numbers) -> untyped
|
35
|
-
|
36
|
-
def internal_decode: (untyped hash, untyped alphabet) -> untyped
|
37
|
-
|
38
|
-
def consistent_shuffle: (untyped alphabet, untyped salt) -> untyped
|
39
|
-
|
40
|
-
def hash: (untyped input, untyped alphabet) -> untyped
|
41
|
-
|
42
|
-
def unhash: (untyped input, untyped alphabet) -> untyped
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def setup_alphabet: () -> untyped
|
47
|
-
|
48
|
-
def setup_seps: () -> untyped
|
49
|
-
|
50
|
-
def setup_guards: () -> untyped
|
51
|
-
|
52
|
-
SaltError: ArgumentError
|
53
|
-
|
54
|
-
MinLengthError: ArgumentError
|
55
|
-
|
56
|
-
AlphabetError: ArgumentError
|
57
|
-
|
58
|
-
InputError: ArgumentError
|
59
|
-
|
60
|
-
def validate_attributes: () -> untyped
|
61
|
-
|
62
|
-
def validate_alphabet: () -> (untyped | nil)
|
63
|
-
|
64
|
-
def hex_string?: (untyped string) -> untyped
|
65
|
-
|
66
|
-
def pick_characters: (untyped array, untyped index) -> untyped
|
67
|
-
|
68
|
-
def uniq_characters: (untyped string) -> untyped
|
69
|
-
end
|
70
|
-
|