barcodevalidation 2.3.0 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0ddfbb1e0066701228173d80f24f18eca5bf195e4cb0ba84d1a2b7cff1f306b
4
- data.tar.gz: 21fd5a0a5eb2876b5b764c49d0ae2a4130a2cd4710e0ee3784b56221f5d0c895
3
+ metadata.gz: 69f00057d24894273af1d7404d7152f18067b861c8c0a9c553995cc442328768
4
+ data.tar.gz: 30864684c4ea4a27b44907ba99ba9325109344ff257cb2da3bdd10055a5d0ead
5
5
  SHA512:
6
- metadata.gz: eac5d8884e82da6c0f57b1042887d8337a6f1bebb91062b068919f42513e90a869edfd048389fd4529a08537a326a582dcd9d0110e327d8dd1726cd93eebb0fb
7
- data.tar.gz: 8448952e7fa2e83336f67de3af3b6b1f3cee49d57ed180df5402c4d9b85136fa332ee345b4c4a8c024be909d709125e29d7ca42c0df228e4a5013b0d4c6e4d4c
6
+ metadata.gz: d81de8495506f006796a5f40db56b365faf3df44859f954eba74dda4ec17dd18bd86c5f9b51e9e4205b845d1593be82e50f61245e0151b9d52cff9f2e4b5fd6a
7
+ data.tar.gz: 46ca1e1ea7522c114501e8d72c9cbc70eaabae4886d50885a6f620abf0bb28a9ce6f982f9177b0c324fd9aa418b7d0f6558a4923e9eb51e801a350910ee9fc0b
data/README.md CHANGED
@@ -40,20 +40,26 @@ and it's pretty flexible about what you give it.
40
40
 
41
41
  ```ruby
42
42
  gtin = BarcodeValidation.scan("937179-004167")
43
- # => #<BarcodeValidation::GTIN(937179004167)>
43
+ # => #<BarcodeValidation::GTIN::GTIN12(937179004167)>
44
44
  gtin.to_s # => "937179004167"
45
45
  gtin.valid? # => true
46
46
  gtin.check_digit # => #<BarcodeValidation::GTIN::CheckDigit(7)>
47
47
  gtin.first(6) # => #<BarcodeValidation::DigitSequence(937179)>
48
48
  gtin.slice(0..5) # => #<BarcodeValidation::DigitSequence(937179)>
49
+ gtin.to_gtin_13 # => #<BarcodeValidation::GTIN::GTIN13(0937179004167)>
50
+ gtin.to_all_valid
51
+ # => [#<BarcodeValidation::GTIN::GTIN12(937179004167)>,
52
+ #<BarcodeValidation::GTIN::GTIN123(0937179004167)>]
49
53
 
50
54
  bad = BarcodeValidation.scan(937_179_004_162)
51
- # => #<BarcodeValidation::GTIN(937179004162)>
55
+ # => #<BarcodeValidation::InvalidGTIN(937179004162)>
52
56
  bad.valid? # => false
53
57
  bad.check_digit # => #<BarcodeValidation::GTIN::CheckDigit(2) invalid: expected 7>
54
58
  bad.check_digit.valid? # => false
55
59
  bad.check_digit.actual # => #<BarcodeValidation::Digit(2)>
56
60
  bad.check_digit.expected # => #<BarcodeValidation::Digit(7)>
61
+ bad.to_gtin_13 # => #<BarcodeValidation::InvalidGTIN(937179004162)>
62
+ bad.to_all_valid # => []
57
63
  ```
58
64
 
59
65
 
@@ -22,5 +22,25 @@ module BarcodeValidation
22
22
 
23
23
  @error.inspect
24
24
  end
25
+
26
+ def to_all_valid
27
+ []
28
+ end
29
+
30
+ def to_gtin_8
31
+ self
32
+ end
33
+
34
+ def to_gtin_12
35
+ self
36
+ end
37
+
38
+ def to_gtin_13
39
+ self
40
+ end
41
+
42
+ def to_gtin_14
43
+ self
44
+ end
25
45
  end
26
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BarcodeValidation
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barcodevalidation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marketplacer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: adamantium