isbn 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/isbn.rb +6 -1
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
@@ -16,10 +16,11 @@ module ISBN
16
16
  else isbn << ck.to_s
17
17
  end
18
18
  end
19
+ alias :as_ten :ten
19
20
 
20
21
  def thirteen(isbn)
21
22
  raise InvalidISBNError unless isbn.is_a? String
22
- raise Invalid13DigitISBN unless isbn.size.between?(10,13)
23
+ raise Invalid13DigitISBN unless (isbn.size == 10 || isbn.size == 13)
23
24
  isbn = isbn.delete("-")
24
25
  isbn = isbn.rjust(13,"978")[/(.+)\w/,1] # adjust to 13 digit isbn and remove check digit
25
26
  raise Invalid13DigitISBN unless isbn.size == 12 # after adjustments isbn should be 12 digits
@@ -28,6 +29,7 @@ module ISBN
28
29
  else isbn << ck.to_s
29
30
  end
30
31
  end
32
+ alias :as_thirteen :thirteen
31
33
 
32
34
  def as_used(isbn)
33
35
  case isbn.size
@@ -42,6 +44,7 @@ module ISBN
42
44
  else valid?(isbn)
43
45
  end
44
46
  end
47
+ alias :used :as_used
45
48
 
46
49
  def as_new(isbn)
47
50
  case isbn.size
@@ -56,6 +59,8 @@ module ISBN
56
59
  else valid?(isbn)
57
60
  end
58
61
  end
62
+
63
+ alias :unused :as_new
59
64
 
60
65
  def valid?(isbn)
61
66
  isbn = isbn.delete("-")
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.2
4
+ version: 2.0.3
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: 2009-11-20 00:00:00 -08:00
12
+ date: 2009-12-30 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15