encoded_id 1.0.0.rc2 → 1.0.0.rc4

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
  SHA256:
3
- metadata.gz: d7e11278f039a19d4fa201541b907a3f52e5b73c440ba0870c6e8a4fd068bb99
4
- data.tar.gz: 70d726b45f982670895c1ddccbbf7e9f42b4a6ab3e6eca8439ac5e58ce399fe0
3
+ metadata.gz: '0844f07baeecd48a70bf0b2564dfb9f02998b002279b44bf75bd0172ccc265be'
4
+ data.tar.gz: 0bcd81de8a4ea7e034097a92dff9ba82478d92f87f7820dda872a9f35b5294d3
5
5
  SHA512:
6
- metadata.gz: fcfad8b207316c8041ddd6cd8687a17b9e04c5bcdca8b73084aae2e4a241c5b2c10247fe24f513e66d939ab97289bb1206458f0fab70cc6a04415224ec62083b
7
- data.tar.gz: c3d4148b9ddddac5eb2dc47b58c2beb6e88e0e3be9c207328e36c825adbce05826c3eaeb6b4d2023160da65286c177e3a3085f222ba7ba7eb529dab995939cb3
6
+ metadata.gz: 4dcf3c99891f8a3a195d188656d1c45c9471760dfbc715fe994fac4c4145a086d9573b663c5a4a79894c71c4e3a15bf68ff0d30b20e44b8fe661c68f1707c065
7
+ data.tar.gz: 8edb3675d565ff7be88441fcdb2a55783415f170fcd8d9102c6bb0fff8cc6fa0d22f1af19e72dd5558dedb37ba2af23c29fd6171d12da2032a0e2ce187bedeca
data/CHANGELOG.md CHANGED
@@ -1,15 +1,36 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.0.0] - 2023-08-06
3
+ ## [2.0.0.alpha1] - unreleased
4
+
5
+ ### Breaking changes
6
+
7
+ - `ReversibleId` now no longer downcases the encodedid input string by default on decode, ie the `decode` option `downcase` is now `false`. In a future release the `downcase` option will be removed.
8
+
9
+ ## [1.0.0.rc4] - unreleased
10
+
11
+ - Add an optional `max_inputs_per_id` argument to `ReversibleId`, thanks to [@avcwisesa](https://github.com/avcwisesa)
12
+
13
+ ## [1.0.0.rc3] - 2023-10-23
14
+
15
+ - Add an optional `max_length` argument to `ReversibleId`, thanks to [@jugglebird](https://github.com/jugglebird)
16
+ - Alphabet validations to prevent whitespace and null chars
17
+ - Add `Alphabet#to_a`, `Alphabet#to_s`, `Alphabet#size` and a custom `Alphabet#inspect`
18
+ - Fixes to input validations
19
+ - hashids are case-sensitive, as are `Alphabet`s, however `ReversibleId` was always `downcase`ing the encodedid input string on decode. A new option has been added to `decode` and `decode_hex`, `downcase`, which defaults to `true`. Thus, the default behaviour is unchanged, but you can opt out to allow mixed case encodedid decode. *Note:* In V2 this will default to `false`.
20
+
21
+ ## [1.0.0.rc2] - 2023-08-07
22
+
23
+ - `Alphabet` now has `#include?` and `#unique_charaters` methods
24
+
25
+ ## [1.0.0.rc1] - 2023-08-06
4
26
 
5
27
  - Improved RBS definitions
6
28
  - Improved test coverage
7
- - `Alphabet` now has `#include?` and `#unique_charaters` methods
8
29
 
9
30
  ## [0.4.0] - 2022-12-04
10
31
 
11
- - Support custom split character which must not be in the alphabet
12
- - Ability to provide a custom character equivalences mapping
32
+ - Support custom 'split' character which must not be in the alphabet
33
+ - Ability to provide a custom character equivalence mapping
13
34
 
14
35
  ## [0.3.0] - 2022-10-12
15
36
 
data/Gemfile CHANGED
@@ -7,8 +7,18 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
 
10
- gem "minitest", "~> 5.0"
10
+ gem "minitest"
11
11
 
12
12
  gem "standard", "~> 1.30"
13
13
 
14
- gem "steep", "~> 1.5"
14
+ gem "rbs"
15
+
16
+ gem "steep"
17
+
18
+ gem "simplecov"
19
+
20
+ gem "benchmark-ips"
21
+
22
+ gem "benchmark-memory"
23
+
24
+ gem "fuzzbert"
data/README.md CHANGED
@@ -33,16 +33,27 @@ coder.decode("z2j7-Odmw") # (note the capital 'o' instead of zero)
33
33
 
34
34
  ## Features
35
35
 
36
- * encoded IDs are reversible (uses with https://hashids.org))
37
- * supports multiple IDs encoded in one encoded string (eg `7aq6-0zqw` decodes to `[78, 45]`)
38
- * supports encoding of hex strings (eg UUIDs), including multiple IDs encoded in one string **(experimental)**
39
- * supports custom alphabets for the encoded string (at least 16 characters needed)
36
+ * 🔄 encoded IDs are reversible (uses with https://hashids.org))
37
+ * 👥 supports multiple IDs encoded in one encoded string (eg `7aq6-0zqw` decodes to `[78, 45]`)
38
+ * 🔡 supports custom alphabets for the encoded string (at least 16 characters needed)
40
39
  - by default uses a variation of the Crockford reduced character set (https://www.crockford.com/base32.html)
41
- - easily confused characters (eg `i` and `j`, `0` and `O`, `1` and `I` etc) are mapped to counterpart characters, to help
40
+ - 👓 easily confused characters (eg `i` and `j`, `0` and `O`, `1` and `I` etc) are mapped to counterpart characters, to help
42
41
  avoid common readability mistakes when reading/sharing
43
- - build in profanity limitation
44
- * encoded string can be split into groups of letters to improve human-readability
42
+ - 🤬 build in profanity limitation
43
+ * 🤓 encoded string can be split into groups of letters to improve human-readability
45
44
  - eg `nft9hr834htu` as `nft9-hr83-4htu`
45
+ * 🥽 supports limits on length to prevent resource exhaustion on encoding and decoding
46
+ * configured with sensible defaults
47
+
48
+ I aim for 100% test coverage and have fuzz tested quite extensively. But please report any issues!
49
+
50
+ ### Experimental
51
+
52
+ * support for encoding of hex strings (eg UUIDs), including multiple IDs encoded in one string
53
+
54
+ ### Coming soon
55
+
56
+ Performance improvements and benchmarking!
46
57
 
47
58
  ### Rails support `encoded_id-rails`
48
59
 
@@ -117,9 +128,27 @@ The encoded ID is configurable. The following can be changed:
117
128
 
118
129
  The actual length of the encoded string can be longer if the inputs cannot be represented in the minimum length.
119
130
 
131
+ ### `max_length`
132
+
133
+ `max_length`: the maximum length of the encoded string. The default is 128 characters.
134
+
135
+ The maximum length represents both the longest encoded string that will be generated and also a limit on
136
+ the maximum input length that will be decoded. If the encoded string exceeds `max_length` then a
137
+ `EncodedIdLengthError` will be raised. If the input exceeds `max_length` then a `InvalidInputError` will
138
+ be raised. If `max_length` is set to `nil`, then no validation, even using the default will be performed.
139
+
140
+ ### `max_inputs_per_id`
141
+
142
+ `max_inputs_per_id`: the maximum amount of IDs to be encoded together. The default is 32.
143
+
144
+ This maximum amount is used to limit:
145
+ - the length of array input passed to `encode`
146
+ - the length of integer array encoded in hex string(s) passed to `encode_hex` function.
147
+ `InvalidInputError` wil be raised when array longer than `max_inputs_per_id` is provided.
148
+
120
149
  ### `alphabet`
121
150
 
122
- `alphabet`: the alphabet used in the encoded string. By default it uses a variation of the Crockford reduced character set (https://www.crockford.com/base32.html).
151
+ `alphabet`: the alphabet used in the encoded string. By default, it uses a variation of the Crockford reduced character set (https://www.crockford.com/base32.html).
123
152
 
124
153
  `alphabet` must be an instance of `EncodedId::Alphabet`.
125
154
 
@@ -137,7 +166,8 @@ alphabet = EncodedId::Alphabet.new("0123456789abcdef")
137
166
 
138
167
  `characters`: the characters of the alphabet. Can be a string or array of strings.
139
168
 
140
- Note that the `characters` of the alphabet must be at least 16 _unique_ characters long.
169
+ Note that the `characters` of the alphabet must be at least 16 _unique_ characters long and must not contain any
170
+ whitespace characters.
141
171
 
142
172
 
143
173
  ```ruby
@@ -268,16 +298,17 @@ coder.decode_hex("5jjy-c8d9-hxp2-qsve-rgh9-rxnt-7nb5-tve7-bf84-vr")
268
298
 
269
299
  ## Development
270
300
 
271
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also
272
- run `bin/console` for an interactive prompt that will allow you to experiment.
301
+ After checking out the repo, run `bin/setup` to install dependencies.
273
302
 
274
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version
275
- number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git
276
- commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
303
+ Run `bin/console` for an interactive prompt that will allow you to experiment.
304
+
305
+ ### Running tests
306
+
307
+ Run `bundle exec rake test` to run the tests.
277
308
 
278
309
  ### Type check
279
310
 
280
- First install dependencies:
311
+ First install RBS dependencies:
281
312
 
282
313
  ```bash
283
314
  rbs collection install
@@ -289,7 +320,6 @@ Then run:
289
320
  steep check
290
321
  ```
291
322
 
292
-
293
323
  ## See also
294
324
 
295
325
  - https://hashids.org
@@ -20,8 +20,9 @@ module EncodedId
20
20
  def initialize(characters, equivalences = nil)
21
21
  raise_invalid_alphabet! unless valid_input_characters?(characters)
22
22
  @unique_characters = unique_character_alphabet(characters)
23
- raise_character_set_too_small! unless sufficient_characters?(@unique_characters.size)
24
- raise_invalid_equivalences! unless valid_equivalences?(equivalences, @unique_characters)
23
+ raise_invalid_alphabet! unless valid_characters?
24
+ raise_character_set_too_small! unless sufficient_characters?
25
+ raise_invalid_equivalences! unless valid_equivalences?(equivalences)
25
26
 
26
27
  @characters = unique_characters.join
27
28
  @equivalences = equivalences
@@ -33,29 +34,52 @@ module EncodedId
33
34
  unique_characters.include?(character)
34
35
  end
35
36
 
37
+ def to_a
38
+ unique_characters.dup
39
+ end
40
+
41
+ def to_s
42
+ @characters.dup
43
+ end
44
+
45
+ def inspect
46
+ "#<#{self.class.name} chars: #{unique_characters.inspect}>"
47
+ end
48
+
49
+ def size
50
+ unique_characters.size
51
+ end
52
+ alias_method :length, :size
53
+
36
54
  private
37
55
 
38
56
  def valid_input_characters?(characters)
39
- (characters.is_a?(Array) || characters.is_a?(String)) && characters.size > 0
57
+ return false unless characters.is_a?(Array) || characters.is_a?(String)
58
+ characters.size > 0
40
59
  end
41
60
 
42
61
  def unique_character_alphabet(characters)
43
62
  (characters.is_a?(Array) ? characters : characters.chars).uniq
44
63
  end
45
64
 
46
- def sufficient_characters?(size)
47
- size >= MIN_UNIQUE_CHARACTERS
65
+ def valid_characters?
66
+ unique_characters.size > 0 && unique_characters.grep(/\s|\0/).size == 0
67
+ end
68
+
69
+ def sufficient_characters?
70
+ unique_characters.size >= MIN_UNIQUE_CHARACTERS
48
71
  end
49
72
 
50
- def valid_equivalences?(equivalences, unique_characters)
73
+ def valid_equivalences?(equivalences)
51
74
  return true if equivalences.nil?
52
75
  return false unless equivalences.is_a?(Hash)
76
+ return false if equivalences.any? { |key, value| key.size != 1 || value.size != 1 }
53
77
 
54
78
  (unique_characters & equivalences.keys).empty? && (equivalences.values - unique_characters).empty?
55
79
  end
56
80
 
57
81
  def raise_invalid_alphabet!
58
- raise InvalidAlphabetError, "Alphabet must be a string or array."
82
+ raise InvalidAlphabetError, "Alphabet must be a string or array and not contain whitespace."
59
83
  end
60
84
 
61
85
  def raise_character_set_too_small!
@@ -63,7 +87,7 @@ module EncodedId
63
87
  end
64
88
 
65
89
  def raise_invalid_equivalences!
66
- raise InvalidConfigurationError, "Character equivalences must be a hash or nil."
90
+ raise InvalidConfigurationError, "Character equivalences must be a hash or nil and contain mappings to valid alphabet characters."
67
91
  end
68
92
  end
69
93
  end
@@ -8,20 +8,25 @@ require "hashids"
8
8
  # Note hashIds already has a built in profanity limitation algorithm
9
9
  module EncodedId
10
10
  class ReversibleId
11
- def initialize(salt:, length: 8, split_at: 4, split_with: "-", alphabet: Alphabet.modified_crockford, hex_digit_encoding_group_size: 4)
11
+ def initialize(salt:, length: 8, split_at: 4, split_with: "-", alphabet: Alphabet.modified_crockford, hex_digit_encoding_group_size: 4, max_length: 128, max_inputs_per_id: 32)
12
12
  @alphabet = validate_alphabet(alphabet)
13
13
  @salt = validate_salt(salt)
14
14
  @length = validate_length(length)
15
15
  @split_at = validate_split_at(split_at)
16
16
  @split_with = validate_split_with(split_with, alphabet)
17
17
  @hex_represention_encoder = HexRepresentation.new(hex_digit_encoding_group_size)
18
+ @max_length = validate_max_length(max_length)
19
+ @max_inputs_per_id = validate_max_input(max_inputs_per_id)
18
20
  end
19
21
 
20
22
  # Encode the input values into a hash
21
23
  def encode(values)
22
24
  inputs = prepare_input(values)
23
25
  encoded_id = encoded_id_generator.encode(inputs)
24
- encoded_id = humanize_length(encoded_id) unless split_at.nil?
26
+ encoded_id = humanize_length(encoded_id) unless split_with.nil? || split_at.nil?
27
+
28
+ raise EncodedIdLengthError if max_length_exceeded?(encoded_id)
29
+
25
30
  encoded_id
26
31
  end
27
32
 
@@ -31,15 +36,17 @@ module EncodedId
31
36
  end
32
37
 
33
38
  # Decode the hash to original array
34
- def decode(str)
35
- encoded_id_generator.decode(convert_to_hash(str))
39
+ def decode(str, downcase: true)
40
+ raise InvalidInputError if max_length_exceeded?(str)
41
+
42
+ encoded_id_generator.decode(convert_to_hash(str, downcase))
36
43
  rescue ::Hashids::InputError => e
37
44
  raise EncodedIdFormatError, e.message
38
45
  end
39
46
 
40
47
  # Decode hex strings from a hash
41
- def decode_hex(str)
42
- integers = encoded_id_generator.decode(convert_to_hash(str))
48
+ def decode_hex(str, downcase: true)
49
+ integers = encoded_id_generator.decode(convert_to_hash(str, downcase))
43
50
  hex_represention_encoder.integers_as_hex(integers)
44
51
  end
45
52
 
@@ -50,43 +57,56 @@ module EncodedId
50
57
  :alphabet,
51
58
  :split_at,
52
59
  :split_with,
53
- :hex_represention_encoder
60
+ :hex_represention_encoder,
61
+ :max_length
54
62
 
55
63
  def validate_alphabet(alphabet)
56
- raise InvalidAlphabetError, "alphabet must be an instance of Alphabet" unless alphabet.is_a?(Alphabet)
57
- alphabet
64
+ return alphabet if alphabet.is_a?(Alphabet)
65
+ raise InvalidAlphabetError, "alphabet must be an instance of Alphabet"
58
66
  end
59
67
 
60
68
  def validate_salt(salt)
61
- raise InvalidConfigurationError, "Salt must be a string and longer than 3 characters" unless salt.is_a?(String) && salt.size > 3
62
- salt
69
+ return salt if salt.is_a?(String) && salt.size > 3
70
+ raise InvalidConfigurationError, "Salt must be a string and longer than 3 characters"
63
71
  end
64
72
 
65
73
  # Target length of the encoded string (the minimum but not maximum length)
66
74
  def validate_length(length)
67
- raise InvalidConfigurationError, "Length must be an integer greater than 0" unless length.is_a?(Integer) && length > 0
68
- length
75
+ return length if valid_integer_option?(length)
76
+ raise InvalidConfigurationError, "Length must be an integer greater than 0"
77
+ end
78
+
79
+ def validate_max_length(max_length)
80
+ return max_length if valid_integer_option?(max_length) || max_length.nil?
81
+ raise InvalidConfigurationError, "Max length must be an integer greater than 0"
82
+ end
83
+
84
+ def validate_max_input(max_inputs_per_id)
85
+ return max_inputs_per_id if valid_integer_option?(max_inputs_per_id)
86
+ raise InvalidConfigurationError, "Max inputs per ID must be an integer greater than 0"
69
87
  end
70
88
 
71
89
  # Split the encoded string into groups of this size
72
90
  def validate_split_at(split_at)
73
- unless (split_at.is_a?(Integer) && split_at > 0) || split_at.nil?
74
- raise InvalidConfigurationError, "Split at must be an integer greater than 0 or nil"
75
- end
76
- split_at
91
+ return split_at if valid_integer_option?(split_at) || split_at.nil?
92
+ raise InvalidConfigurationError, "Split at must be an integer greater than 0 or nil"
77
93
  end
78
94
 
79
95
  def validate_split_with(split_with, alphabet)
80
- unless split_with.is_a?(String) && !alphabet.characters.include?(split_with)
81
- raise InvalidConfigurationError, "Split with must be a string and not part of the alphabet"
82
- end
83
- split_with
96
+ return split_with if split_with.nil? || (split_with.is_a?(String) && !alphabet.characters.include?(split_with))
97
+ raise InvalidConfigurationError, "Split with must be a string and not part of the alphabet or nil"
98
+ end
99
+
100
+ def valid_integer_option?(value)
101
+ value.is_a?(Integer) && value > 0
84
102
  end
85
103
 
86
104
  def prepare_input(value)
87
105
  inputs = value.is_a?(Array) ? value.map(&:to_i) : [value.to_i]
88
106
  raise ::EncodedId::InvalidInputError, "Integer IDs to be encoded can only be positive" if inputs.any?(&:negative?)
89
107
 
108
+ raise ::EncodedId::InvalidInputError, "%d integer IDs provided, maximum amount of IDs is %d" % [inputs.length, @max_inputs_per_id] if inputs.length > @max_inputs_per_id
109
+
90
110
  inputs
91
111
  end
92
112
 
@@ -102,16 +122,25 @@ module EncodedId
102
122
  hash.gsub(split_regex, "\\0#{split_with}")
103
123
  end
104
124
 
105
- def convert_to_hash(str)
106
- clean = str.delete(split_with).downcase
107
- alphabet.equivalences.nil? ? clean : map_equivalent_characters(clean)
125
+ def convert_to_hash(str, downcase)
126
+ clean = str.gsub(split_with, "")
127
+ clean = clean.downcase if downcase
128
+ map_equivalent_characters(clean)
108
129
  end
109
130
 
110
131
  def map_equivalent_characters(str)
132
+ return str unless alphabet.equivalences
133
+
111
134
  alphabet.equivalences.reduce(str) do |cleaned, ceq|
112
135
  from, to = ceq
113
136
  cleaned.tr(from, to)
114
137
  end
115
138
  end
139
+
140
+ def max_length_exceeded?(str)
141
+ return false if max_length.nil?
142
+
143
+ str.length > max_length
144
+ end
116
145
  end
117
146
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EncodedId
4
- VERSION = "1.0.0.rc2"
4
+ VERSION = "1.0.0.rc4"
5
5
  end
data/lib/encoded_id.rb CHANGED
@@ -12,5 +12,7 @@ module EncodedId
12
12
 
13
13
  class EncodedIdFormatError < ArgumentError; end
14
14
 
15
+ class EncodedIdLengthError < ArgumentError; end
16
+
15
17
  class InvalidInputError < ArgumentError; end
16
18
  end
data/sig/encoded_id.rbs CHANGED
@@ -3,17 +3,18 @@ module EncodedId
3
3
 
4
4
  InvalidConfigurationError: ::StandardError
5
5
  EncodedIdFormatError: ::ArgumentError
6
+ EncodedIdLengthError: ::ArgumentError
6
7
  InvalidAlphabetError: ::ArgumentError
7
8
  InvalidInputError: ::ArgumentError
8
9
 
9
10
  class Alphabet
10
11
  MIN_UNIQUE_CHARACTERS: ::Integer
11
12
 
12
- def initialize: (String, ?::Hash[::String, ::String]) -> void
13
+ def initialize: (String | ::Array[::String] characters, ::Hash[::String, ::String] ?equivalences) -> void
13
14
 
14
15
  attr_reader unique_characters: ::Array[::String]
15
16
  attr_reader characters: String
16
- attr_reader equivalences: ::Hash[::String, ::String]
17
+ attr_reader equivalences: ::Hash[::String, ::String] | nil
17
18
 
18
19
  def include?: (::String character) -> bool
19
20
 
@@ -23,11 +24,13 @@ module EncodedId
23
24
 
24
25
  def valid_input_characters?: ((::Array[::String] | ::String) characters) -> bool
25
26
 
26
- def sufficient_characters?: (::Integer size) -> bool
27
+ def valid_characters?: -> bool
28
+
29
+ def sufficient_characters?: -> bool
27
30
 
28
31
  def unique_character_alphabet: ((::Array[::String] | ::String) characters) -> ::Array[::String]
29
32
 
30
- def valid_equivalences?: (::Hash[::String, ::String] equivalences, ::Array[::String] unique_characters) -> bool
33
+ def valid_equivalences?: (::Hash[::String, ::String] ?equivalences) -> bool
31
34
 
32
35
  def raise_character_set_too_small!: -> untyped
33
36
 
@@ -56,7 +59,7 @@ module EncodedId
56
59
  end
57
60
 
58
61
  class ReversibleId
59
- def initialize: (salt: ::String, ?length: ::Integer, ?split_at: ::Integer, ?split_with: ::String, ?alphabet: Alphabet, ?hex_digit_encoding_group_size: ::Integer) -> void
62
+ def initialize: (salt: ::String, ?length: ::Integer, ?split_at: ::Integer, ?split_with: ::String, ?alphabet: Alphabet, ?hex_digit_encoding_group_size: ::Integer, ?max_length: ::Integer, ?max_inputs_per_id: ::Integer) -> void
60
63
 
61
64
  # Encode the input values into a hash
62
65
  def encode: (encodeableValue values) -> ::String
@@ -79,6 +82,7 @@ module EncodedId
79
82
  attr_reader salt: ::String
80
83
 
81
84
  attr_reader length: ::Integer
85
+ attr_reader max_length: ::Integer | nil
82
86
 
83
87
  attr_reader alphabet: Alphabet
84
88
 
@@ -90,9 +94,12 @@ module EncodedId
90
94
  def validate_alphabet: (Alphabet) -> Alphabet
91
95
  def validate_salt: (::String) -> ::String
92
96
  def validate_length: (::Integer) -> ::Integer
97
+ def validate_max_length: (::Integer | nil) -> (::Integer | nil)
98
+ def validate_max_input: (::Integer) -> ::Integer
93
99
  def validate_split_at: (::Integer | nil) -> (::Integer | nil)
94
100
  def validate_split_with: (::String, Alphabet) -> ::String
95
101
  def validate_hex_digit_encoding_group_size: (::Integer) -> ::Integer
102
+ def valid_integer_option?: (::Integer | nil) -> bool
96
103
 
97
104
  def prepare_input: (untyped value) -> ::Array[::Integer]
98
105
 
@@ -102,8 +109,9 @@ module EncodedId
102
109
 
103
110
  def humanize_length: (::String hash) -> ::String
104
111
 
105
- def convert_to_hash: (::String str) -> ::String
112
+ def convert_to_hash: (::String str, bool) -> ::String
106
113
 
107
114
  def map_equivalent_characters: (::String str) -> ::String
115
+ def max_length_exceeded?: (::String str) -> bool
108
116
  end
109
117
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encoded_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ierodiaconou
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-07 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashids
@@ -67,11 +67,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  version: 2.7.0
68
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - ">"
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.3.1
72
+ version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.4.10
74
+ rubygems_version: 3.5.3
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: EncodedId is a gem for creating reversible obfuscated IDs from numerical