isbn10 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/isbn10.rb +2 -2
- data/spec/isbn10_spec.rb +5 -3
- metadata +18 -9
data/CHANGELOG
CHANGED
data/lib/isbn10.rb
CHANGED
@@ -6,7 +6,7 @@ class ISBN10
|
|
6
6
|
|
7
7
|
class Version #:nodoc:
|
8
8
|
Major = 1
|
9
|
-
Minor =
|
9
|
+
Minor = 1
|
10
10
|
Tiny = 0
|
11
11
|
|
12
12
|
String = [Major, Minor, Tiny].join('.')
|
@@ -22,7 +22,7 @@ class ISBN10
|
|
22
22
|
|
23
23
|
def self.valid?(isbn)
|
24
24
|
isbn = isbn.to_s.gsub("-","")
|
25
|
-
isbn.length == 10 && isbn == ISBN10.complete(isbn[0,9])
|
25
|
+
isbn.length == 10 && isbn.to_s.upcase == ISBN10.complete(isbn[0,9])
|
26
26
|
end
|
27
27
|
|
28
28
|
# Purely for generating new ean numbers
|
data/spec/isbn10_spec.rb
CHANGED
@@ -7,6 +7,8 @@ describe ISBN10 do
|
|
7
7
|
it "should identify a valid ISBN10" do
|
8
8
|
ISBN10.new("0140449043").valid?.should be_true
|
9
9
|
ISBN10.new("0-140-44904-3").valid?.should be_true
|
10
|
+
ISBN10.new("043429067X").valid?.should be_true
|
11
|
+
ISBN10.new("043429067x").valid?.should be_true
|
10
12
|
end
|
11
13
|
|
12
14
|
it "should identify a valid ISBN10" do
|
@@ -29,9 +31,9 @@ describe ISBN10 do
|
|
29
31
|
|
30
32
|
it "should convert to an EAN correctly" do
|
31
33
|
ISBN10.new("0140449042").to_ean.should be_nil
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
ISBN10.new("0140449043").to_ean.should eql("9780140449044")
|
35
|
+
ISBN10.new("043429067X").to_ean.should eql("9780434290673")
|
36
|
+
ISBN10.new("043429067x").to_ean.should eql("9780434290673")
|
35
37
|
end
|
36
38
|
|
37
39
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isbn10
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 1.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- James Healy
|
@@ -9,19 +14,21 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-07-19 00:00:00 +10:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: ean13
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
23
29
|
version: "0"
|
24
|
-
|
30
|
+
type: :runtime
|
31
|
+
version_requirements: *id001
|
25
32
|
description: a (very) small library for working with ISBN10 codes
|
26
33
|
email: jimmy@deefa.com
|
27
34
|
executables: []
|
@@ -50,18 +57,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
57
|
requirements:
|
51
58
|
- - ">="
|
52
59
|
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
53
62
|
version: "0"
|
54
|
-
version:
|
55
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
64
|
requirements:
|
57
65
|
- - ">="
|
58
66
|
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 0
|
59
69
|
version: "0"
|
60
|
-
version:
|
61
70
|
requirements: []
|
62
71
|
|
63
72
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.3.
|
73
|
+
rubygems_version: 1.3.6
|
65
74
|
signing_key:
|
66
75
|
specification_version: 3
|
67
76
|
summary: a (very) small library for working with ISBN10 codes
|