zapnap-isbn_validation 0.1.0 → 0.1.1
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.
- data/Rakefile +2 -2
- data/lib/isbn_validation.rb +2 -2
- metadata +2 -3
- data/rails/init.rb +0 -2
data/Rakefile
CHANGED
@@ -24,11 +24,11 @@ end
|
|
24
24
|
spec = Gem::Specification.new do |s|
|
25
25
|
s.name = %q{isbn_validation}
|
26
26
|
s.name = %q{isbn_validation}
|
27
|
-
s.version = "0.1.
|
27
|
+
s.version = "0.1.1"
|
28
28
|
s.summary = %q{isbn_validation adds an isbn validation routine to active record models.}
|
29
29
|
s.description = %q{isbn_validation adds an isbn validation routine to active record models.}
|
30
30
|
|
31
|
-
s.files = FileList['[A-Z]*', '{lib,test
|
31
|
+
s.files = FileList['[A-Z]*', '{lib,test}/**/*.rb']
|
32
32
|
s.require_path = 'lib'
|
33
33
|
s.test_files = Dir[*['test/**/*_test.rb']]
|
34
34
|
|
data/lib/isbn_validation.rb
CHANGED
@@ -46,7 +46,7 @@ module Zerosum
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def validate_with_isbn10(isbn) #:nodoc:
|
49
|
-
if isbn.match(ISBN10_REGEX)
|
49
|
+
if (isbn || '').match(ISBN10_REGEX)
|
50
50
|
isbn_values = isbn.upcase.gsub(/\ |-/, '').split('')
|
51
51
|
check_digit = isbn_values.pop # last digit is check digit
|
52
52
|
check_digit = (check_digit == 'X') ? 10 : check_digit.to_i
|
@@ -63,7 +63,7 @@ module Zerosum
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def validate_with_isbn13(isbn) #:nodoc:
|
66
|
-
if isbn.match(ISBN13_REGEX)
|
66
|
+
if (isbn || '').match(ISBN13_REGEX)
|
67
67
|
isbn_values = isbn.upcase.gsub(/\ |-/, '').split('')
|
68
68
|
check_digit = isbn_values.pop.to_i # last digit is check digit
|
69
69
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zapnap-isbn_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Plante
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- test/models.rb
|
39
39
|
- test/schema.rb
|
40
40
|
- test/test_helper.rb
|
41
|
-
- rails/init.rb
|
42
41
|
has_rdoc: true
|
43
42
|
homepage:
|
44
43
|
post_install_message:
|
data/rails/init.rb
DELETED