barkick 0.1.0 → 0.3.0

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: 9b5dbcc3cbd3c1beefb0f273820de7c49cb53571c9835e04d2297d10f43f6c0d
4
- data.tar.gz: aec8454c2c892ae270cd6dae72b7addcacf5350fe56a4e31591b6fb7c0aebaac
3
+ metadata.gz: 94d26a48e4353a2ee1490ac32cc7e6120f7273a8ec6cf1146db59604af44a00f
4
+ data.tar.gz: 9411a760caa760944bee849fb6fa923f985b265789f3c0a4f29b2a64da0856cc
5
5
  SHA512:
6
- metadata.gz: 61276d24be0bec862262e3daabbf9fe4fb4b21715c57d83bfd6309315da5f226b6188783f6c97bc8a4f93bb17695a8fe930f324cad5d2ba7186148104f331087
7
- data.tar.gz: ccdcc7ba14612a379ee382eadb09898ad8f6715cbb7cc01e2bed4c01c01181886aa43be165aa97f2d475ab80b175310f085b8e2048a67589bf289b537658c2f1
6
+ metadata.gz: 983f51fbbef0f186ac1eaf3f38556f5047d4ab23fcb5cc6f0f76cf6828e246bc763259d71f6832a628d6fa632f12c3ddcb489297f52c34133d02d99f8adfb046
7
+ data.tar.gz: 6a683a2948fdfb33a015992f5d1cc86fd62cd540650d71d39ab16ee46bb51ac5b2d0c3518d4f78d68fc32c22290d2aa860a0c540932492c38d39b74686f8016d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
- ## 0.1.0
1
+ ## 0.3.0 (2024-10-23)
2
+
3
+ - Dropped support for Ruby < 3.1
4
+
5
+ ## 0.2.0 (2022-10-09)
6
+
7
+ - Dropped support for Ruby < 2.7
8
+
9
+ ## 0.1.0 (2018-07-27)
2
10
 
3
11
  - `GTIN` is now `Barkick::GTIN`
4
12
  - 8-digit codes now raise an `ArgumentError` if `type` is not specified
5
13
  - Added `type` option
14
+
15
+ ## 0.0.4 (2014-04-17)
16
+
17
+ - Fixed false positives for `valid?`
18
+
19
+ ## 0.0.3 (2014-01-22)
20
+
21
+ - Added support for UPC-E
22
+ - Added `country_code` method
23
+
24
+ ## 0.0.2 (2013-09-29)
25
+
26
+ - Added more prefixes
27
+
28
+ ## 0.0.1 (2013-09-19)
29
+
30
+ - First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Andrew Kane
1
+ Copyright (c) 2013-2022 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -11,6 +11,16 @@ Works with:
11
11
 
12
12
  For PLU codes, check out the [plu gem](https://github.com/ankane/plu)
13
13
 
14
+ [![Build Status](https://github.com/ankane/barkick/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/barkick/actions)
15
+
16
+ ## Installation
17
+
18
+ Add this line to your Gemfile:
19
+
20
+ ```ruby
21
+ gem "barkick"
22
+ ```
23
+
14
24
  ## How To Use
15
25
 
16
26
  ```ruby
@@ -56,28 +66,9 @@ Barkick::GTIN.check_digit("01600027526") # "3"
56
66
 
57
67
  > For UPC-E, convert to UPC-A before passing to this method
58
68
 
59
- ## Installation
60
-
61
- Add this line to your Gemfile:
69
+ ## Resources
62
70
 
63
- ```ruby
64
- gem 'barkick'
65
- ```
66
-
67
- And run:
68
-
69
- ```sh
70
- bundle
71
- ```
72
-
73
- ## Upgrading
74
-
75
- ### 0.1.0
76
-
77
- There a few breaking changes to be aware of:
78
-
79
- - `GTIN` is now `Barkick::GTIN`
80
- - 8-digit codes now raise an `ArgumentError` if `type` is not specified
71
+ - [GS1 General Specifications](https://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf)
81
72
 
82
73
  ## History
83
74
 
@@ -91,3 +82,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
91
82
  - Fix bugs and [submit pull requests](https://github.com/ankane/barkick/pulls)
92
83
  - Write, clarify, or fix documentation
93
84
  - Suggest or add new features
85
+
86
+ To get started with development:
87
+
88
+ ```sh
89
+ git clone https://github.com/ankane/barkick.git
90
+ cd barkick
91
+ bundle install
92
+ bundle exec rake test
93
+ ```
data/lib/barkick/gtin.rb CHANGED
@@ -246,14 +246,10 @@ module Barkick
246
246
  digits = number.rjust(13, "0").split("").map(&:to_i)
247
247
  # digit at position 0 is odd (first digit) for the purpose of this calculation
248
248
  odd_digits, even_digits = digits.partition.each_with_index { |_digit, i| i.even? }
249
- ((10 - (sum(odd_digits) * 3 + sum(even_digits)) % 10) % 10).to_s
249
+ ((10 - (odd_digits.sum * 3 + even_digits.sum) % 10) % 10).to_s
250
250
  else
251
251
  nil
252
252
  end
253
253
  end
254
-
255
- def self.sum(arr)
256
- arr.inject { |sum, x| sum + x }
257
- end
258
254
  end
259
255
  end
@@ -1,3 +1,3 @@
1
1
  module Barkick
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/barkick.rb CHANGED
@@ -1,2 +1,2 @@
1
- require "barkick/gtin"
2
- require "barkick/version"
1
+ require_relative "barkick/gtin"
2
+ require_relative "barkick/version"
metadata CHANGED
@@ -1,59 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-28 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- description:
56
- email: andrew@chartkick.com
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: andrew@ankane.org
57
15
  executables: []
58
16
  extensions: []
59
17
  extra_rdoc_files: []
@@ -68,7 +26,7 @@ homepage: https://github.com/ankane/barkick
68
26
  licenses:
69
27
  - MIT
70
28
  metadata: {}
71
- post_install_message:
29
+ post_install_message:
72
30
  rdoc_options: []
73
31
  require_paths:
74
32
  - lib
@@ -76,16 +34,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
34
  requirements:
77
35
  - - ">="
78
36
  - !ruby/object:Gem::Version
79
- version: '2.2'
37
+ version: '3.1'
80
38
  required_rubygems_version: !ruby/object:Gem::Requirement
81
39
  requirements:
82
40
  - - ">="
83
41
  - !ruby/object:Gem::Version
84
42
  version: '0'
85
43
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.7.7
88
- signing_key:
44
+ rubygems_version: 3.5.16
45
+ signing_key:
89
46
  specification_version: 4
90
47
  summary: Barcodes made easy
91
48
  test_files: []