revs-utils 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/README.rdoc +1 -0
- data/lib/revs-utils/version.rb +1 -1
- data/lib/revs-utils.rb +3 -3
- data/spec/revs-utils_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmFjYTMzM2Y5Y2E0OWEzZGJlMzQ2OWVlMWRiYzBhNWNhMGUyYTQ0Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmZlOGYwNzE1MWNkM2U4OTVlMDk4MDdiOGJiNGQ5NDJlMTI4YzliYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2RjNzRiNjkxNzMwZWY0M2MyZTkwOGU5YWZmZTU2OGJhMzUyY2E2MDdmMjc1
|
10
|
+
ZWNmMzE2MmExMjI2NzZmMmU1MjFkZWVjMzE0Y2ZmZTI4OWZhN2VlMzg1Y2Q5
|
11
|
+
ZWZiNTAyZDkxOGE5M2Y5NmE5ODMwOWEzOTRmNjViNTVjZmQxNjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzljOGVhNGZmNWE2Mzk3ODUyNDNkY2QyNDM2NzJkNDM5M2Y2MTkyMGZhNzll
|
14
|
+
YzdiMjdiOWVjY2QwYWJhMjE1YjQ3OTU4YmViZTMwYzUwMzE2NzllNmZiYTg1
|
15
|
+
MDEwYWRiNDk4MDMzODE5MzU2ZDkwNTZiMTQ1ZDgzODhlNjg2Mzk=
|
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -21,6 +21,7 @@ Shared methods and functions used by revs-indexer, pre-assembly and bulk metadat
|
|
21
21
|
- <b>2.0.0</b> Updating to use ActionPack 4 for Rails 4 applications. For Rails 3, continue to use 1.x.y releases.
|
22
22
|
- <b>2.0.1</b> Add more common format corrections
|
23
23
|
- <b>2.0.2 and 2.0.3</b> Update valid for metadata method so it is not sensitive to blank or uppercase columns
|
24
|
+
- <b>2.0.4</b> Fix issues with year parsing
|
24
25
|
|
25
26
|
== Running tests
|
26
27
|
|
data/lib/revs-utils/version.rb
CHANGED
data/lib/revs-utils.rb
CHANGED
@@ -257,14 +257,14 @@ module Revs
|
|
257
257
|
years_to_add=[]
|
258
258
|
result.each do |year|
|
259
259
|
|
260
|
-
if year.scan(/[1-2][0-9][0-9][0-9][-][0-9][0-9]/).size > 0 # if we have a year that looks like "1961-62" or "1961-73", lets deal with it turning it into [1961,1962] or [1961,1962,1963,1964,1965,1966,1967...etc]
|
260
|
+
if year.scan(/[1-2][0-9][0-9][0-9][-][0-9][0-9]/).size > 0 && year.size == 7 # if we have a year that looks like "1961-62" or "1961-73", lets deal with it turning it into [1961,1962] or [1961,1962,1963,1964,1965,1966,1967...etc]
|
261
261
|
start_year=year[2..3]
|
262
262
|
end_year=year[5..6]
|
263
263
|
stem=year[0..1]
|
264
264
|
for n in start_year..end_year
|
265
265
|
years_to_add << "#{stem}#{n}"
|
266
266
|
end
|
267
|
-
elsif year.scan(/[1-2][0-9][0-9][0-9][-][1-9]/).size > 0 # if we have a year that lloks like "1961-2" or "1961-3", lets deal with it turning it into [1961,1962] or [1961,1962,1963]
|
267
|
+
elsif year.scan(/[1-2][0-9][0-9][0-9][-][1-9]/).size > 0 && year.size == 6 # if we have a year that lloks like "1961-2" or "1961-3", lets deal with it turning it into [1961,1962] or [1961,1962,1963]
|
268
268
|
start_year=year[3..3]
|
269
269
|
end_year=year[5..5]
|
270
270
|
stem=year[0..2]
|
@@ -279,7 +279,7 @@ module Revs
|
|
279
279
|
%w{0 1 2 3 4 5 6 7 8 9}.each {|n| years_to_add << "#{stem}#{n}"} # add each year in that decade to the output array
|
280
280
|
end
|
281
281
|
|
282
|
-
if year.scan(/[1-2][0-9][0-9][0-9][-][1-2][0-9][0-9][0-9]/).size > 0 # if we have a year that lloks like "1961-1962" or "1930-1955", lets deal with it turning it into [1961,1962] or [1961,1962,1963]
|
282
|
+
if year.scan(/[1-2][0-9][0-9][0-9][-][1-2][0-9][0-9][0-9]/).size > 0 && year.size == 9 # if we have a year that lloks like "1961-1962" or "1930-1955", lets deal with it turning it into [1961,1962] or [1961,1962,1963]
|
283
283
|
start_year=year[0..3]
|
284
284
|
end_year=year[5..8]
|
285
285
|
if end_year.to_i - start_year.to_i < 10 # let's only do the expansion if we don't have some really large date range, like "1930-1985" .. only ranges less than 9 years will be split into separate years
|
data/spec/revs-utils_spec.rb
CHANGED
@@ -149,6 +149,12 @@ describe "Revs-Utils" do
|
|
149
149
|
|
150
150
|
end
|
151
151
|
|
152
|
+
it "should parse 1800-1802" do
|
153
|
+
|
154
|
+
@revs.parse_years('1800-1802').should == ['1800','1801','1802']
|
155
|
+
|
156
|
+
end
|
157
|
+
|
152
158
|
it "should parse 1955-1957 correctly" do
|
153
159
|
|
154
160
|
@revs.parse_years('1955-1957').should == ['1955','1956','1957']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revs-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Mangiafico
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: countries
|