plu 0.1.0 → 0.3.0

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: 5ebb5e1cd19eac381d10559e8cc3eb6c677e72b9dbeecd813eaeaa72321c0a3b
4
- data.tar.gz: f3b708193fdb2c3141773d56119a6f3b962800df765c4e595b56dde55e0f1f7e
3
+ metadata.gz: 5d522d5c6813065f75cffd798d290167c38f93c821ddd13d8baae7012a734afe
4
+ data.tar.gz: 67330e92e78f30336a97ffea8874288ba5b6d0aeeb449c9ff743a5af491d8d12
5
5
  SHA512:
6
- metadata.gz: aab4745787c570015bb83bfa6f4678836725ddda29b981d6cd827a60c0539cb25745dd9c70fb43c4238e1d4b568e92b5dd130d149804f1ebb78acb45788572fd
7
- data.tar.gz: 9be68fed85be0ea19878fe7299c5b242a3c47111b1a8861bece4f9db7e2128d27db6a070aa83f87785465533abcbfec3c8f3c6b9e3bf93f9c3f18d37d1476c91
6
+ metadata.gz: aeb6d27127f09eb2a03461b64c898b87d4b957df269c97e14e47123339bab25c5d4f7497e964c2e727c23ea8d422e5a874456ef9b3838d3c3e5a7e31fe01fcac
7
+ data.tar.gz: aefc7630d69c63e237da055f1032567777ad3f2dc8a0bbce6aeb246adbd4fc7003704d2298fd79aeade2cfd18b19168cea6f11c4d47ef02fd5ab8a1a28de9bc8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
- ## 0.1.0
1
+ ## 0.3.0 (2023-10-23)
2
+
3
+ - Dropped support for Ruby < 3.1
4
+
5
+ ## 0.2.0 (2022-09-03)
6
+
7
+ - Added latest PLU codes
8
+ - Removed `gm?` method (no longer reserved)
9
+ - Dropped support for Ruby < 2.7
10
+
11
+ ## 0.1.0 (2019-10-08)
2
12
 
3
13
  - Added latest PLU codes
14
+
15
+ ## 0.0.3 (2013-12-30)
16
+
17
+ - Added `retailer_assigned?` method
18
+
19
+ ## 0.0.2 (2013-09-20)
20
+
21
+ - Added known PLU codes
22
+
23
+ ## 0.0.1 (2013-09-18)
24
+
25
+ - First release
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013-2019 Andrew Kane
1
+ Copyright (c) 2013-2024 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -6,9 +6,19 @@
6
6
  :banana: 4011
7
7
  :grapes: 4023
8
8
 
9
- [Download PLU codes](https://raw.github.com/ankane/plu/master/plu_codes.csv) - data cleaned up from the [Produce Marketing Association](http://www.plucodes.com)
9
+ Data cleaned up from the [International Federation of Produce Standards](https://www.ifpsglobal.com/)
10
10
 
11
- ## How To Use
11
+ [![Build Status](https://github.com/ankane/plu/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/plu/actions)
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application’s Gemfile:
16
+
17
+ ```ruby
18
+ gem "plu"
19
+ ```
20
+
21
+ ## Getting Started
12
22
 
13
23
  List known PLUs
14
24
 
@@ -30,15 +40,13 @@ PLU.new(2000).valid? # false
30
40
 
31
41
  ### 5-Digit PLUs
32
42
 
33
- For PLUs with 5 digits, the first digit has a special meaning: 9 specifies organic, and 8 specifies genetically modified.
43
+ For PLUs with 5 digits, the first digit has a special meaning: 9 specifies organic.
34
44
 
35
45
  4011 - Bananas :banana:
36
46
  94011 - Organic bananas :banana:
37
- 84011 - Genetically modified bananas
38
47
 
39
48
  ```ruby
40
49
  PLU.new(94011).organic? # true
41
- PLU.new(84011).gm? # true
42
50
  ```
43
51
 
44
52
  ### Retailer Assigned
@@ -47,24 +55,6 @@ PLU.new(84011).gm? # true
47
55
  PLU.new(3170).retailer_assigned? # true
48
56
  ```
49
57
 
50
- ## Installation
51
-
52
- Add this line to your Gemfile:
53
-
54
- ```ruby
55
- gem "plu"
56
- ```
57
-
58
- And run:
59
-
60
- ```sh
61
- bundle
62
- ```
63
-
64
- ## Resources
65
-
66
- - [IFPS 2012 Users Guide](http://www.plucodes.com/docs/Users_Guide_July_2012_FINAL.pdf)
67
-
68
58
  ## History
69
59
 
70
60
  View the [changelog](https://github.com/ankane/plu/blob/master/CHANGELOG.md)
@@ -77,4 +67,12 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
77
67
  - Fix bugs and [submit pull requests](https://github.com/ankane/plu/pulls)
78
68
  - Write, clarify, or fix documentation
79
69
  - Suggest or add new features
80
- - Help clean up [data](https://github.com/ankane/plu/blob/master/plu_codes.csv)
70
+
71
+ To get started with development:
72
+
73
+ ```sh
74
+ git clone https://github.com/ankane/plu.git
75
+ cd plu
76
+ bundle install
77
+ bundle exec rake test
78
+ ```
data/lib/plu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class PLU
2
- VERSION = "0.1.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/plu.rb CHANGED
@@ -1,4 +1,8 @@
1
- require "csv"
1
+ # stdlib
2
+ require "json"
3
+
4
+ # modules
5
+ require_relative "plu/version"
2
6
 
3
7
  class PLU
4
8
  def initialize(number)
@@ -17,23 +21,12 @@ class PLU
17
21
  modifier == "9"
18
22
  end
19
23
 
20
- def gm?
21
- modifier == "8"
22
- end
23
-
24
24
  def retailer_assigned?
25
25
  name.to_s.start_with?("Retailer Assigned")
26
26
  end
27
27
 
28
- # TODO more items
29
28
  def self.all
30
- @all ||= begin
31
- all = {}
32
- CSV.foreach File.expand_path("../../plu_codes.csv", __FILE__), headers: true do |row|
33
- all[row["PLU Code"]] = row["Name"]
34
- end
35
- all
36
- end
29
+ @all ||= JSON.load_file(File.expand_path("../plu_codes.json", __dir__))
37
30
  end
38
31
 
39
32
  protected
metadata CHANGED
@@ -1,59 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plu
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: 2019-10-09 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: []
@@ -63,12 +21,11 @@ files:
63
21
  - README.md
64
22
  - lib/plu.rb
65
23
  - lib/plu/version.rb
66
- - plu_codes.csv
67
24
  homepage: https://github.com/ankane/plu
68
25
  licenses:
69
26
  - MIT
70
27
  metadata: {}
71
- post_install_message:
28
+ post_install_message:
72
29
  rdoc_options: []
73
30
  require_paths:
74
31
  - lib
@@ -76,15 +33,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
33
  requirements:
77
34
  - - ">="
78
35
  - !ruby/object:Gem::Version
79
- version: '2.4'
36
+ version: '3.1'
80
37
  required_rubygems_version: !ruby/object:Gem::Requirement
81
38
  requirements:
82
39
  - - ">="
83
40
  - !ruby/object:Gem::Version
84
41
  version: '0'
85
42
  requirements: []
86
- rubygems_version: 3.0.3
87
- signing_key:
43
+ rubygems_version: 3.5.16
44
+ signing_key:
88
45
  specification_version: 4
89
46
  summary: Price look-up codes made easy
90
47
  test_files: []