sqids 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sqids.rb +1 -1
- data/spec/blocklist_spec.rb +11 -0
- data/spec/uniques_spec.rb +1 -1
- data/sqids.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c79695a1c507e1785e6c454fed0e0f4bca689598608d5b680b019493dfe9406
|
4
|
+
data.tar.gz: 9c64e11d7b0a8c551caf8b24d73fd01cb0aaf8ade971a4b6d535f120e1be8d9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9992329b56a99da95e7ee85e1b928407d7cbb40f5312cbc18a0f17ed95b0ba51b175088dc84db69d894bfa0814d587f5cdbe327c7a6a1d56c89eb004c68a83ae
|
7
|
+
data.tar.gz: 00d797e9d692a9c4ad82f80971649d2e4553d317c78b72e258ae497fa94521246205e56873971685b42d9b4ee7d8507d71bdf4c05fd80eab9735f58176adf230
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
**v0.1.2:**
|
4
|
+
- Bug fix: spec update (PR #7): blocklist filtering in uppercase-only alphabet [[PR #7](https://github.com/sqids/sqids-spec/pull/7)]
|
5
|
+
- Lower uniques test from 1_000_000 to 10_000
|
6
|
+
|
3
7
|
**v0.1.1:**
|
4
8
|
- Lowering Ruby version requirement to 3.0
|
5
9
|
|
data/lib/sqids.rb
CHANGED
@@ -28,7 +28,7 @@ class Sqids
|
|
28
28
|
end
|
29
29
|
|
30
30
|
filtered_blocklist = blocklist.select do |word|
|
31
|
-
word.length >= 3 && (word.chars - alphabet.chars).empty?
|
31
|
+
word.length >= 3 && (word.downcase.chars - alphabet.downcase.chars).empty?
|
32
32
|
end.to_set(&:downcase)
|
33
33
|
|
34
34
|
@alphabet = shuffle(alphabet)
|
data/spec/blocklist_spec.rb
CHANGED
@@ -52,4 +52,15 @@ describe Sqids do
|
|
52
52
|
|
53
53
|
expect(sqids.decode(sqids.encode([1_000]))).to eq([1_000])
|
54
54
|
end
|
55
|
+
|
56
|
+
it 'blocklist filtering in constructor' do
|
57
|
+
# lowercase blocklist in only-uppercase alphabet
|
58
|
+
sqids = Sqids.new(alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', blocklist: Set.new(['sqnmpn']))
|
59
|
+
|
60
|
+
id = sqids.encode([1, 2, 3])
|
61
|
+
numbers = sqids.decode(id)
|
62
|
+
|
63
|
+
expect(id).to eq('ULPBZGBM') # without blocklist, would've been "SQNMPN"
|
64
|
+
expect(numbers).to eq([1, 2, 3])
|
65
|
+
end
|
55
66
|
end
|
data/spec/uniques_spec.rb
CHANGED
data/sqids.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sqids Maintainers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|