entangledstate-isbn 1.0.2 → 1.1.0

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.
Files changed (6) hide show
  1. data/LICENSE +20 -0
  2. data/README +9 -0
  3. data/Rakefile +40 -0
  4. data/VERSION.yml +2 -2
  5. data/lib/isbn.rb +8 -0
  6. metadata +15 -10
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Tim Kersey
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,9 @@
1
+ isbn
2
+ ====
3
+
4
+ Description goes here.
5
+
6
+ COPYRIGHT
7
+ =========
8
+
9
+ Copyright (c) 2008 Tim Kersey. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+ require 'rcov/rcovtask'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |s|
9
+ s.name = "isbn"
10
+ s.summary = "a simple library of functions on ISBN\'s"
11
+ s.email = "entangledstate@gmail.com"
12
+ s.homepage = "http://github.com/entangledstate/isbn"
13
+ s.description = "library to transform ISBN\'s from new to used, between 10 and 13, etc..."
14
+ s.authors = ["Tim Kersey"]
15
+ end
16
+ rescue LoadError
17
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
+ end
19
+
20
+ Rake::TestTask.new do |t|
21
+ t.libs << 'lib'
22
+ t.pattern = 'test/**/*_test.rb'
23
+ t.verbose = false
24
+ end
25
+
26
+ Rake::RDocTask.new do |rdoc|
27
+ rdoc.rdoc_dir = 'rdoc'
28
+ rdoc.title = 'isbn'
29
+ rdoc.options << '--line-numbers' << '--inline-source'
30
+ rdoc.rdoc_files.include('README*')
31
+ rdoc.rdoc_files.include('lib/**/*.rb')
32
+ end
33
+
34
+ Rcov::RcovTask.new do |t|
35
+ t.libs << 'test'
36
+ t.test_files = FileList['test/**/*_test.rb']
37
+ t.verbose = true
38
+ end
39
+
40
+ task :default => :rcov
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 1
2
+ :patch: 0
3
3
  :major: 1
4
- :minor: 0
4
+ :minor: 1
data/lib/isbn.rb CHANGED
@@ -51,6 +51,14 @@ module ISBN
51
51
  end
52
52
  end
53
53
 
54
+ def ten(isbn)
55
+ case isbn.size
56
+ when 13 then from_13_to_10(isbn)
57
+ when 10 then isbn
58
+ else raise InvalidISBNError
59
+ end
60
+ end
61
+
54
62
  def valid?(isbn)
55
63
  begin
56
64
  isbn[-1,1] == calculate(isbn)[-1,1]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entangledstate-isbn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
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-01-13 00:00:00 -08:00
12
+ date: 2009-04-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,18 +19,22 @@ executables: []
19
19
 
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files: []
23
-
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README
24
25
  files:
26
+ - LICENSE
27
+ - Rakefile
25
28
  - VERSION.yml
26
29
  - lib/isbn.rb
27
30
  - test/isbn_test.rb
28
31
  - test/test_helper.rb
29
- has_rdoc: false
32
+ - README
33
+ has_rdoc: true
30
34
  homepage: http://github.com/entangledstate/isbn
31
35
  post_install_message:
32
- rdoc_options: []
33
-
36
+ rdoc_options:
37
+ - --charset=UTF-8
34
38
  require_paths:
35
39
  - lib
36
40
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -50,7 +54,8 @@ requirements: []
50
54
  rubyforge_project:
51
55
  rubygems_version: 1.2.0
52
56
  signing_key:
53
- specification_version: 2
57
+ specification_version: 3
54
58
  summary: a simple library of functions on ISBN's
55
- test_files: []
56
-
59
+ test_files:
60
+ - test/isbn_test.rb
61
+ - test/test_helper.rb