nitv 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/nitv.rb +5 -1
- data/lib/nitv/version.rb +1 -1
- 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: b42fed3454529eb746310a496e09059548d6b54a
|
4
|
+
data.tar.gz: b2cdd28b5e096e618cd33d51767a969ef3c59f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 640777d51791a97c6818885e46eb5fabfc63d7fc77219da7cc2df84cc4e93e74b7870d349a7a11a52176ded8ffd9fb93bff7ac6fc5b41e72027d9d4fc736177f
|
7
|
+
data.tar.gz: be651dbde8259073c9f032b0cdab5101edc729faac205f990b5d220054da3fc15986434c363bb3cfd0bd5db1dfe7b0a212a6068fd37e7d29f45c1a25d18b8111
|
data/lib/nitv.rb
CHANGED
@@ -2,7 +2,8 @@ require "nitv/version"
|
|
2
2
|
|
3
3
|
module Nitv
|
4
4
|
def self.is_valid?(nit)
|
5
|
-
raise Nitv::
|
5
|
+
raise Nitv::NitTypeError, "nit should be a string" unless nit.class == String
|
6
|
+
raise Nitv::NitFormatError, "nit format should be xxxxxx-x" unless /^[0-9]+-[0-9k]$/ =~ nit
|
6
7
|
|
7
8
|
nums = nit[0, nit.index("-")].chars
|
8
9
|
checker = nit.chars.last == "k" ? 10 : nit.chars.last.to_i
|
@@ -20,4 +21,7 @@ module Nitv
|
|
20
21
|
|
21
22
|
class NitFormatError < StandardError
|
22
23
|
end
|
24
|
+
|
25
|
+
class NitTypeError < StandardError
|
26
|
+
end
|
23
27
|
end
|
data/lib/nitv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bronzdoc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|