easy-pin 1.0.0 → 1.0.1
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/lib/easy_pin.rb +5 -3
- 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: ffbd58ed3c7be964dab979c9a9aed62179be8eeb
|
|
4
|
+
data.tar.gz: 4b9c04ac02796e000e49fcc6e97e75412ba240c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 07855548d444c90cd6cc4ff2477245b650cdb9a101875225a6442a1baf105d30e55609ef1216cb2459306c3aa15e15b9697436fb366145f671a05f7bfae9db31
|
|
7
|
+
data.tar.gz: a800a81357b1cf3e007653d7357e87ce64b6ffae53eb9ab5f1f0bbae331ffabc1e81583c4237c2430cb3ba96255ab1945c92afbfd59fcad952ec4e5aa8cac5ce
|
data/lib/easy_pin.rb
CHANGED
|
@@ -54,7 +54,10 @@ module EasyPin
|
|
|
54
54
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
class
|
|
57
|
+
class Error < StandardError; end
|
|
58
|
+
class InvalidInput < Error; end
|
|
59
|
+
class InvalidChecksum < Error; end
|
|
60
|
+
class InvalidConfig < Error; end
|
|
58
61
|
|
|
59
62
|
class BaseConverter
|
|
60
63
|
def initialize(base)
|
|
@@ -83,8 +86,6 @@ module EasyPin
|
|
|
83
86
|
end
|
|
84
87
|
end
|
|
85
88
|
|
|
86
|
-
class InvalidChecksum < StandardError; end
|
|
87
|
-
|
|
88
89
|
class ChecksumGenerator
|
|
89
90
|
def initialize(base)
|
|
90
91
|
@base = base
|
|
@@ -133,6 +134,7 @@ module EasyPin
|
|
|
133
134
|
|
|
134
135
|
class Tumbler
|
|
135
136
|
def initialize(dictionary, random, max_width = 32)
|
|
137
|
+
raise InvalidConfig, 'Dictionary must have more than one item' if dictionary.size < 2
|
|
136
138
|
@shuffle = (0..max_width-1).map{ dictionary.shuffle(random: random) }
|
|
137
139
|
@unshuffle = @shuffle.map{ |dict| Hash[dict.each_with_index.map{|a,b| [a,b]}] }
|
|
138
140
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easy-pin
|
|
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
|
- Ben Wong
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-04-
|
|
11
|
+
date: 2017-04-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Generates reversable 'pin codes' from database primary keys
|
|
14
14
|
email:
|