hashids 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/hashids.rb +3 -3
- data/spec/hashids_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f35febe06ea136b13641845c57ec208d60aa40e
|
4
|
+
data.tar.gz: 23757c01a68fd1effa709a40e2aebfd6825a126d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15be6da0e98af26bc7506526820fe5b37b481c9be9b13c05bf52b67632c6554c4bb350f93d6f262edc554808c5b664544cebc60497970cfb3b44a191af7e1be6
|
7
|
+
data.tar.gz: 873982fd791ff1fe6a8166ff956cb2249d23c87136df69e3a928b0959c6badd820873c2ceab6a8a66226ef618aa854c9366a465662dfb10676db362407e6ac2c
|
data/README.md
CHANGED
@@ -208,6 +208,11 @@ hex_str = hashids.decode_hex("kRNrpKlJ")
|
|
208
208
|
|
209
209
|
## Changelog
|
210
210
|
|
211
|
+
**1.0.1**
|
212
|
+
|
213
|
+
- Final alphabet length can now be shorter than the minimum alphabet length
|
214
|
+
- `validate_alphabet` now run before setting up seps & guards
|
215
|
+
|
211
216
|
**1.0.0**
|
212
217
|
|
213
218
|
- Public functions renamed to be more appropriate:
|
data/lib/hashids.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Hashids
|
4
|
-
VERSION = "1.0.
|
4
|
+
VERSION = "1.0.1"
|
5
5
|
|
6
6
|
MIN_ALPHABET_LENGTH = 16
|
7
7
|
SEP_DIV = 3.5
|
@@ -193,10 +193,10 @@ class Hashids
|
|
193
193
|
|
194
194
|
@alphabet = uniq_characters(alphabet)
|
195
195
|
|
196
|
+
validate_alphabet
|
197
|
+
|
196
198
|
setup_seps
|
197
199
|
setup_guards
|
198
|
-
|
199
|
-
validate_alphabet
|
200
200
|
end
|
201
201
|
|
202
202
|
def setup_seps
|
data/spec/hashids_spec.rb
CHANGED
@@ -63,6 +63,11 @@ describe Hashids do
|
|
63
63
|
}.must_raise Hashids::AlphabetError
|
64
64
|
end
|
65
65
|
|
66
|
+
it "has a final alphabet length that can be shorter than the minimum" do
|
67
|
+
Hashids.new("this is my salt", 0, 'cfhistuCFHISTU01').
|
68
|
+
alphabet.must_equal "10"
|
69
|
+
end
|
70
|
+
|
66
71
|
it "checks the alphabet for spaces" do
|
67
72
|
-> {
|
68
73
|
Hashids.new("", 0, 'abc odefghijklmnopqrstuv')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Hellberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Use hashids when you do not want to expose your database ids to the user.
|
14
14
|
email:
|