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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/easy_pin.rb +5 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc4c5c9486d8b183e647a22be1cea6fa6eb04cac
4
- data.tar.gz: 439988b68c6f7ca8b5bf7a904fa645888ccdae23
3
+ metadata.gz: ffbd58ed3c7be964dab979c9a9aed62179be8eeb
4
+ data.tar.gz: 4b9c04ac02796e000e49fcc6e97e75412ba240c7
5
5
  SHA512:
6
- metadata.gz: b47a00ea3c9c7fd932e0f18c4b11c2bb4f681b8caa9c954b14c3b3419aa15a6baab05969cb8f6025dba6beddb52e9a5f6618c4f61cc3fcb752c0fb9c34f02c2a
7
- data.tar.gz: 1c5c578417b2a52d2c1068e2f8aabde4fc73a91f6e33ed67c179f8c1bb8505fae5c40fc506299fe9c642613064d233d1256181072b2039a3f2edc29518ab6fdd
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 InvalidInput < StandardError; end
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.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-21 00:00:00.000000000 Z
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: