lisbn 0.2.2 → 0.2.3

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.
@@ -8,7 +8,7 @@ class Lisbn < String
8
8
  ranges = xml["ISBNRangeMessage"]["RegistrationGroups"]["Group"]
9
9
 
10
10
  hash = Array(ranges).flatten.inject({}) do |memo, group|
11
- prefix = group["Prefix"].gsub(/-/, '')
11
+ prefix = group["Prefix"].gsub(/-/, '').to_s
12
12
  ranges = Array(group["Rules"]["Rule"]).flatten.map do |rule|
13
13
  length = rule["Length"].to_i
14
14
  next unless length > 0
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "lisbn"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.2.2"
15
+ gem.version = "0.2.3"
16
16
 
17
17
  gem.add_dependency "nori", "~> 2.0"
18
18
  gem.add_dependency "nokogiri"
@@ -11,47 +11,47 @@ describe "Lisbn" do
11
11
  describe "#valid?" do
12
12
  it "recognizes a valid ISBN10" do
13
13
  isbn = Lisbn.new("0123456789")
14
- isbn.valid?.should be_true
14
+ isbn.valid?.should be true
15
15
  end
16
16
 
17
17
  it "recognizes a valid ISBN10 with X checksum" do
18
18
  isbn = Lisbn.new("160459411X")
19
- isbn.valid?.should be_true
19
+ isbn.valid?.should be true
20
20
  end
21
21
 
22
22
  it "recognizes a valid ISBN10 with 0 checksum" do
23
23
  isbn = Lisbn.new("0679405070")
24
- isbn.valid?.should be_true
24
+ isbn.valid?.should be true
25
25
  end
26
26
 
27
27
  it "recognizes an invalid ISBN10" do
28
28
  isbn = Lisbn.new("0123546789")
29
- isbn.valid?.should be_false
29
+ isbn.valid?.should be false
30
30
  end
31
31
 
32
32
  it "recognizes a valid ISBN13" do
33
33
  isbn = Lisbn.new("9780000000002")
34
- isbn.valid?.should be_true
34
+ isbn.valid?.should be true
35
35
  end
36
36
 
37
37
  it "recognizes a valid ISBN13 with 0 checksum" do
38
38
  isbn = Lisbn.new("9780062870780")
39
- isbn.valid?.should be_true
39
+ isbn.valid?.should be true
40
40
  end
41
41
 
42
42
  it "recognizes an invalid ISBN13" do
43
43
  isbn = Lisbn.new("9780000000003")
44
- isbn.valid?.should be_false
44
+ isbn.valid?.should be false
45
45
  end
46
46
 
47
47
  it "returns false for improperly-formatted ISBNs" do
48
48
  isbn = Lisbn.new("97800000X0002")
49
- isbn.valid?.should be_false
49
+ isbn.valid?.should be false
50
50
  end
51
51
 
52
52
  it "regards anything not 10 or 13 digits as invalid" do
53
53
  isbn = Lisbn.new("")
54
- isbn.valid?.should be_false
54
+ isbn.valid?.should be false
55
55
  end
56
56
  end
57
57
 
@@ -2,6 +2,6 @@ require "multi_json"
2
2
  require "nori"
3
3
  require_relative "../lib/lisbn/ranges"
4
4
 
5
- task :save_ranges_to_json do
6
- Lisbn::Ranges.save_to_json!
5
+ task :save_ranges_to_yaml do
6
+ Lisbn::Ranges.save_to_yaml!
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lisbn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Ragalie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-29 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nori
@@ -76,7 +76,7 @@ files:
76
76
  - spec/cache_method_spec.rb
77
77
  - spec/lisbn_spec.rb
78
78
  - spec/spec_helper.rb
79
- - tasks/save_ranges_to_json.rake
79
+ - tasks/save_ranges_to_yaml.rake
80
80
  homepage: https://github.com/ragalie/lisbn
81
81
  licenses: []
82
82
  metadata: {}
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.4.6
99
+ rubygems_version: 2.6.14
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: Provides methods for converting between ISBN-10 and ISBN-13, checking validity
@@ -105,4 +105,3 @@ test_files:
105
105
  - spec/cache_method_spec.rb
106
106
  - spec/lisbn_spec.rb
107
107
  - spec/spec_helper.rb
108
- has_rdoc: