jan 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: fb219c80ec39b892cb26016a2745e10140963a9c6dc9ee21c91c63264f5a4417
4
- data.tar.gz: 342b4538022acef94a4f3f5520c683f2471eb9c8439113f46f601618666a6907
3
+ metadata.gz: 3f8becc9d54183c8d1cf62d1b6d9a7bdef63a84a3665aa2770745d58c3fb8f67
4
+ data.tar.gz: 5db39280c3810f914d61e6f3a656801e7aa38f1f028bdec7fa4417901b396dbb
5
5
  SHA512:
6
- metadata.gz: 4b310cd1048cd3cfa70a55f479b3c13367f507691f93722e94cd2ecfb06821e027939fd142c497b98ea8c3dcb9180100a1c798ab8240ce67d0f0c6237a3647f6
7
- data.tar.gz: eed13eb7f19cde0483510825f6a792c0d7edabbb81d8bb30f46ccc1fa62299230964bc3b641bb38b2ae6318aa16643b74a29c9e2f9e2bff6d6e83a737a5ff4c3
6
+ metadata.gz: 9074880acb2b9b6a23e64534a77d0029df53f3c3c0f791d6b73ba18874ab1aff4c3395fe1897576b7e7f8bf20920097480a0f32f23c0925db49dfb81186c5f7e
7
+ data.tar.gz: 5cd5c301d286fc08375da7521f91f9ac6935c267cbe74a7b32efacfd82fb7a29604cb78e946b9a57cddcb89cee7943948f7252cb8e77cfc216c3d0383c4411a0
data/README.md CHANGED
@@ -43,7 +43,8 @@ code.valid? # => true
43
43
  code.body # => '490127724112'
44
44
  code.check_digit # => '6'
45
45
 
46
- code.instore_code? # => false
46
+ code.source_marking? # => true
47
+ code.instore_marking? # => false
47
48
  ```
48
49
 
49
50
  ### Calculate check digit
@@ -10,7 +10,7 @@ module Jan
10
10
 
11
11
  # @return [boolean]
12
12
  def valid?
13
- @code_body.match?(/\A\d{12}\z/)
13
+ @code_body.match?(/\A(\d{12}|\d{7})\z/)
14
14
  end
15
15
 
16
16
  # @return [Jan::CheckDigit]
@@ -1,3 +1,3 @@
1
1
  module Jan
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -7,6 +7,8 @@ describe Jan::Code do
7
7
  0000000000000
8
8
  4901277241126
9
9
  2000000000015
10
+ 00000000
11
+ 49123456
10
12
  ]
11
13
 
12
14
  valid_codes.each do |valid_code|
@@ -18,8 +20,10 @@ describe Jan::Code do
18
20
  invalid_codes = [
19
21
  '11',
20
22
  '123abc',
23
+ '4901277241127', #Invalid check digit
21
24
  '4901277 241126',
22
25
  '4901277 24112',
26
+ '49123457', # Invalid check digit
23
27
  ]
24
28
 
25
29
  invalid_codes.each do |invalid_code|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OSA Shunsuke