vindetta 0.22.0 → 0.23.0

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
  SHA1:
3
- metadata.gz: 3e52bd3fc58569ee1e717f6372ff6227b8219a21
4
- data.tar.gz: ee50be5daaf7a62fbc1111beb3aba4acb5b84c1c
3
+ metadata.gz: 431f60cb9e88b478d17ac6364e430add13aae1aa
4
+ data.tar.gz: 744ed0e12ac60ca9d2ec5f099120a82b1c702c2d
5
5
  SHA512:
6
- metadata.gz: 75ec9d9db8ef290a3752880073d81a341689490a2116c4448c43abc5d7413d80e9a457c6b5e9ed28c1fd53c90a33b900268663b530ed3605087680a8d9ab07c9
7
- data.tar.gz: 25af18504e2ac497d671127a5f7448e59f25ef66977fb2c0a40ba235bc8cf89053604a140abbd50326cbf723637dc76f6a7483c1ef2d80d0bd623f9f48acdd20
6
+ metadata.gz: be530f83c70f9d5ca9626596e0b01ee2760da8981fc9ea2a2d0ecd02ab462c3615c01fa87497dc886a5d2ea5b6f1e5823cf05419305fcf9999adb377e2f13e36
7
+ data.tar.gz: 824a3482af1ace05096c5742f8266c46323fb62911230acc79268b829b29e31325ead79b8a92825027c95edb66eed5e86e8c2cff2127cc519a9d61678985dde0
data/README.md CHANGED
@@ -29,18 +29,17 @@ SYNOPSIS
29
29
  vindetta [global options] command [command options] [arguments...]
30
30
 
31
31
  VERSION
32
- 0.16.0
32
+ 0.22.0
33
33
 
34
34
  GLOBAL OPTIONS
35
35
  --help - Show this message
36
36
  --version - Display the program version
37
37
 
38
38
  COMMANDS
39
- decode, d - Decodes a VIN
40
- generate, g - Generates a random VIN
41
- help - Shows a list of commands or help for one command
42
- transliterate, t - Transliterates a VIN character
43
- validate, v - Validates a VIN
39
+ decode, d - Decodes a VIN
40
+ generate, g - Generates a random VIN
41
+ help - Shows a list of commands or help for one command
42
+ validate, v - Validates a VIN
44
43
  ```
45
44
 
46
45
  ## Development
@@ -1,8 +1,14 @@
1
1
  module Vindetta
2
2
  class Calculator
3
+ InvalidCharacterError = Class.new(StandardError)
4
+
3
5
  def self.check_digit(vin)
4
6
  transliterator = -> (c) do
5
- "0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ".chars.index(c) % 10
7
+ index = "0123456789.ABCDEFGH..JKLMN.P.R..STUVWXYZ".chars.index(c)
8
+
9
+ raise InvalidCharacterError if index.nil?
10
+
11
+ index % 10
6
12
  end
7
13
 
8
14
  summer = -> (sum, (a, b)) do
@@ -4,6 +4,8 @@ module Vindetta
4
4
  return false unless vin.length == Vindetta::VIN_LENGTH
5
5
 
6
6
  Calculator.check_digit(vin) == Decoder.vin(vin)[:check_digit]
7
+ rescue Calculator::InvalidCharacterError
8
+ false
7
9
  end
8
10
 
9
11
  def self.wmi(wmi)
@@ -1,3 +1,3 @@
1
1
  module Vindetta
2
- VERSION = "0.22.0".freeze
2
+ VERSION = "0.23.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vindetta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Decot
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli