isbn 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/isbn.rb +3 -3
- data/test/isbn_spec.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.4
|
data/lib/isbn.rb
CHANGED
@@ -41,7 +41,7 @@ module ISBN
|
|
41
41
|
when /^291/ then isbn
|
42
42
|
end
|
43
43
|
when 10 then thirteen("290#{isbn}")
|
44
|
-
else
|
44
|
+
else raise ISBN::InvalidISBNError
|
45
45
|
end
|
46
46
|
end
|
47
47
|
alias :used :as_used
|
@@ -56,7 +56,7 @@ module ISBN
|
|
56
56
|
when /^291/ then thirteen("979#{isbn[3..-1]}")
|
57
57
|
end
|
58
58
|
when 10 then ten(isbn)
|
59
|
-
else
|
59
|
+
else raise ISBN::InvalidISBNError
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -67,7 +67,7 @@ module ISBN
|
|
67
67
|
case isbn.size
|
68
68
|
when 13 then isbn[-1] == thirteen(isbn)[-1]
|
69
69
|
when 10 then isbn[-1] == ten(isbn)[-1]
|
70
|
-
else
|
70
|
+
else false
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
data/test/isbn_spec.rb
CHANGED
@@ -58,6 +58,6 @@ describe ISBN do
|
|
58
58
|
ISBN.valid?("2900820472675").must_equal true
|
59
59
|
ISBN.valid?("012781910X").must_equal true
|
60
60
|
ISBN.valid?("9887401392").must_equal false
|
61
|
-
|
61
|
+
ISBN.valid?("082047267").must_equal false
|
62
62
|
end
|
63
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isbn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Kersey
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-13 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|