lisbn 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lisbn/lisbn.rb +11 -1
- data/lisbn.gemspec +1 -1
- metadata +4 -4
data/lib/lisbn/lisbn.rb
CHANGED
@@ -117,7 +117,7 @@ private
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def self.ranges
|
120
|
-
rngs =
|
120
|
+
rngs = parse
|
121
121
|
Array(rngs["ISBNRangeMessage"]["RegistrationGroups"]["Group"]).flatten.inject({}) do |memo, group|
|
122
122
|
prefix = group["Prefix"].gsub(/-/, '')
|
123
123
|
ranges = Array(group["Rules"]["Rule"]).flatten.map do |rule|
|
@@ -131,5 +131,15 @@ private
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
+
# Some gems (read: savon) modify Nori's .convert_tags_to option.
|
135
|
+
# We save the modification, reset to defaults and reinstate after parsing.
|
136
|
+
def self.parse
|
137
|
+
conversion = Nori.convert_tags?
|
138
|
+
Nori.convert_tags_to(nil)
|
139
|
+
rngs = Nori.parse(File.read(File.dirname(__FILE__) + '/../../data/RangeMessage.xml'))
|
140
|
+
Nori.convert_tags_to(nil, &conversion)
|
141
|
+
rngs
|
142
|
+
end
|
143
|
+
|
134
144
|
RANGES = ranges
|
135
145
|
end
|
data/lisbn.gemspec
CHANGED
@@ -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.1.
|
15
|
+
gem.version = "0.1.2"
|
16
16
|
|
17
17
|
gem.add_dependency "nori"
|
18
18
|
gem.add_development_dependency "rspec"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lisbn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Ragalie
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: nori
|