barkick 0.1.0 → 0.2.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: 01e8eea64a01cbd499ee4a39cba88f262b6a43954b7fda2010ff5e31ece1ead6
4
+ data.tar.gz: ba076bab4f6703027d48312d0ab427a69b97bbe68dc7aa3d5c5bac8ae4e11d56
5
5
  SHA512:
6
- metadata.gz: 61276d24be0bec862262e3daabbf9fe4fb4b21715c57d83bfd6309315da5f226b6188783f6c97bc8a4f93bb17695a8fe930f324cad5d2ba7186148104f331087
7
- data.tar.gz: ccdcc7ba14612a379ee382eadb09898ad8f6715cbb7cc01e2bed4c01c01181886aa43be165aa97f2d475ab80b175310f085b8e2048a67589bf289b537658c2f1
6
+ metadata.gz: 55d5d5b24587097bf264f8ab56ce731dee81cbfd54b1fe481e0ca86c026e73494c6225d1f45ae55b05c43abfda553bd64a0586240ae69db0cb9953c3329a29dd
7
+ data.tar.gz: adc1eab9da02f55bc98765613042be0240e066d3ab17c697876f719aa145372efca0d57a4bc9b154c49474d33ac207a32e5843386ab2d7c44f6c9da9bc670742
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.1.0
1
+ ## 0.2.0 (2022-10-09)
2
+
3
+ - Dropped support for Ruby < 2.7
4
+
5
+ ## 0.1.0 (2018-07-27)
2
6
 
3
7
  - `GTIN` is now `Barkick::GTIN`
4
8
  - 8-digit codes now raise an `ArgumentError` if `type` is not specified
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/workflows/build/badge.svg?branch=master)](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,19 +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
69
+ ## Resources
60
70
 
61
- Add this line to your Gemfile:
62
-
63
- ```ruby
64
- gem 'barkick'
65
- ```
66
-
67
- And run:
68
-
69
- ```sh
70
- bundle
71
- ```
71
+ - [GS1 General Specifications](https://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf)
72
72
 
73
73
  ## Upgrading
74
74
 
@@ -91,3 +91,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
91
91
  - Fix bugs and [submit pull requests](https://github.com/ankane/barkick/pulls)
92
92
  - Write, clarify, or fix documentation
93
93
  - Suggest or add new features
94
+
95
+ To get started with development:
96
+
97
+ ```sh
98
+ git clone https://github.com/ankane/barkick.git
99
+ cd barkick
100
+ bundle install
101
+ bundle exec rake test
102
+ ```
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.2.0"
3
3
  end
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.2.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: 2022-10-10 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: '2.7'
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.3.7
45
+ signing_key:
89
46
  specification_version: 4
90
47
  summary: Barcodes made easy
91
48
  test_files: []