ean8 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2395cf0350df3d2aec15672c53ccf44dc391a43
4
+ data.tar.gz: 8da949e4640fb1aa64f87d776d2cf6e0585c5427
5
+ SHA512:
6
+ metadata.gz: 6a0964dc7aa64da05b3b869d299f97433fe7625ae03f702ec5aa49fccd99c79acb7b34f0948bf0f79e51ba6419ca62f502f9aac185be148f0e8be17809b4bae4
7
+ data.tar.gz: de4266019e9fc330b6b32b038f63008cdd90e88e36563c18902097267a6be4c50dd327df1e78363f738a14f2168831f37dff3a0a1e2da34bac106d176455def0
data/CHANGELOG CHANGED
@@ -1,2 +1,5 @@
1
+ v1.1 (16th July 2017)
2
+ - Updated packaging to work well with ruby 1.9.3 to 2.4
3
+
1
4
  v1.0 (7th June 2010)
2
5
  - Initial Release
data/README.markdown ADDED
@@ -0,0 +1,35 @@
1
+ A small class for generating and validating EAN-8's, the 8 digit codes found
2
+ on many products sold around the world.
3
+
4
+ # Installation
5
+
6
+ gem install ean8
7
+
8
+ # Usage
9
+
10
+ EAN8.new("93469647").valid?
11
+ => true
12
+
13
+ EAN8.valid?("93469647")
14
+ => true
15
+
16
+ EAN8.valid?("93469646")
17
+ => false
18
+
19
+ EAN8.complete("9346964")
20
+ => "93469647"
21
+
22
+ EAN8.new("93469647").to_ean
23
+ => "0000093469647"
24
+
25
+ EAN8.new("93469647").to_gtin
26
+ => "00000093469647"
27
+
28
+ # Further Reading
29
+
30
+ - http://en.wikipedia.org/wiki/EAN_8
31
+
32
+ # Contributing
33
+
34
+ Source code is publicly available @ http://github.com/yob/ean8
35
+ Patches welcome, preferably via a git repo I can pull from.
data/lib/ean8.rb CHANGED
@@ -1,9 +1,8 @@
1
-
2
1
  class EAN8
3
2
 
4
3
  class Version #:nodoc:
5
4
  Major = 1
6
- Minor = 0
5
+ Minor = 1
7
6
  Tiny = 0
8
7
 
9
8
  String = [Major, Minor, Tiny].join('.')
data/spec/ean8_spec.rb CHANGED
@@ -1,36 +1,33 @@
1
- $LOAD_PATH << File.dirname(__FILE__) + "/../lib"
2
-
3
- require 'spec'
4
1
  require 'ean8'
5
2
 
6
3
  describe EAN8 do
7
4
  it "should identify a valid EAN8" do
8
- EAN8.new("93469647").valid?.should be_true
5
+ expect(EAN8.new("93469647").valid?).to be_truthy
9
6
  end
10
7
 
11
8
  it "should identify a valid EAN8" do
12
- EAN8.valid?("93469647").should be_true
13
- EAN8.valid?(93469647).should be_true
9
+ expect(EAN8.valid?("93469647")).to be_truthy
10
+ expect(EAN8.valid?(93469647)).to be_truthy
14
11
  end
15
12
 
16
13
  it "should identify an invalid EAN8" do
17
- EAN8.valid?(nil).should be_false
18
- EAN8.valid?("978184354916").should be_false
19
- EAN8.valid?(Array).should be_false
20
- EAN8.valid?(Array.new).should be_false
21
- EAN8.valid?("93469648").should be_false
14
+ expect(EAN8.valid?(nil)).to be_falsey
15
+ expect(EAN8.valid?("978184354916")).to be_falsey
16
+ expect(EAN8.valid?(Array)).to be_falsey
17
+ expect(EAN8.valid?(Array.new)).to be_falsey
18
+ expect(EAN8.valid?("93469648")).to be_falsey
22
19
  end
23
20
 
24
21
  it "should calculate a EAN8 check digit correctly" do
25
- EAN8.complete("9346964").should eql("93469647")
26
- EAN8.complete(9346964).should eql("93469647")
22
+ expect(EAN8.complete("9346964")).to eql("93469647")
23
+ expect(EAN8.complete(9346964)).to eql("93469647")
27
24
  end
28
25
 
29
26
  it "should convert to an EAN-13 correctly" do
30
- EAN8.new("93469647").to_ean.should eql("0000093469647")
27
+ expect(EAN8.new("93469647").to_ean).to eql("0000093469647")
31
28
  end
32
29
 
33
30
  it "should convert to a GTIN-14 correctly" do
34
- EAN8.new("93469647").to_gtin.should eql("00000093469647")
31
+ expect(EAN8.new("93469647").to_gtin).to eql("00000093469647")
35
32
  end
36
33
  end
metadata CHANGED
@@ -1,67 +1,80 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ean8
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - James Healy
13
8
  autorequire:
14
9
  bindir: bin
15
10
  cert_chain: []
16
-
17
- date: 2010-06-07 00:00:00 +10:00
18
- default_executable:
19
- dependencies: []
20
-
11
+ date: 2017-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
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: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
21
41
  description: a (very) small library for working with EAN-8 codes
22
42
  email: jimmy@deefa.com
23
43
  executables: []
24
-
25
44
  extensions: []
26
-
27
45
  extra_rdoc_files: []
28
-
29
- files:
30
- - lib/ean8.rb
31
- - MIT-LICENSE
32
- - README.rdoc
46
+ files:
33
47
  - CHANGELOG
34
- has_rdoc: true
48
+ - MIT-LICENSE
49
+ - README.markdown
50
+ - lib/ean8.rb
51
+ - spec/ean8_spec.rb
35
52
  homepage: http://github.com/yob/ean8
36
- licenses: []
37
-
53
+ licenses:
54
+ - MIT
55
+ metadata: {}
38
56
  post_install_message:
39
- rdoc_options:
40
- - --title
57
+ rdoc_options:
58
+ - "--title"
41
59
  - EAN-8
42
- - --line-numbers
43
- require_paths:
60
+ - "--line-numbers"
61
+ require_paths:
44
62
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- requirements:
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
47
65
  - - ">="
48
- - !ruby/object:Gem::Version
49
- segments:
50
- - 0
51
- version: "0"
52
- required_rubygems_version: !ruby/object:Gem::Requirement
53
- requirements:
66
+ - !ruby/object:Gem::Version
67
+ version: 1.9.3
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
54
70
  - - ">="
55
- - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
- version: "0"
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
59
73
  requirements: []
60
-
61
74
  rubyforge_project:
62
- rubygems_version: 1.3.6
75
+ rubygems_version: 2.6.11
63
76
  signing_key:
64
- specification_version: 3
77
+ specification_version: 4
65
78
  summary: a (very) small library for working with EAN-8 codes
66
- test_files:
79
+ test_files:
67
80
  - spec/ean8_spec.rb
data/README.rdoc DELETED
@@ -1,35 +0,0 @@
1
- A small class for generating and validating EAN-8's, the 8 digit codes found
2
- on many products sold around the world.
3
-
4
- = Installation
5
-
6
- gem install ean8
7
-
8
- = Usage
9
-
10
- EAN8.new("93469647").valid?
11
- => true
12
-
13
- EAN8.valid?("93469647")
14
- => true
15
-
16
- EAN8.valid?("93469646")
17
- => false
18
-
19
- EAN8.complete("9346964")
20
- => "93469647"
21
-
22
- EAN8.new("93469647").to_ean
23
- => "0000093469647"
24
-
25
- EAN8.new("93469647").to_gtin
26
- => "00000093469647"
27
-
28
- = Further Reader
29
-
30
- - http://en.wikipedia.org/wiki/EAN_8
31
-
32
- = Contributing
33
-
34
- Source code is publicly available @ http://github.com/yob/ean8
35
- Patches welcome, preferably via a git repo I can pull from.