revs-utils 1.0.10 → 1.0.11

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWQxZWMzYTlmNTI0NzM1ZDRmZWU0MmYzZWI5ZmJhMzVkMjJhMzU0Mg==
4
+ YzdjYjY1ZDg5Mjk4MjEzOGE2YTI3MTQyOTI1ZWJiYThjYTc0NmEwOA==
5
5
  data.tar.gz: !binary |-
6
- ODRiMDc1MWFjOGFiNmZlYTVmOTQyYjZhOGM1YmZiOWM2MzRhZDMzMA==
6
+ OWVhMWUzN2QyM2ExNzgyMGE2NDVmY2Y4ODhmZmMxZDhlNzE4NGE3YQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2E0ZWQ2NWYzMDVjOWYzNDJhYjMwYTllODYyYWVlY2ZmN2E5YmVhZjc5ZDU1
10
- NTMwYTZiYTc4YWJkNTFmM2E5ZDMwY2JjNjQ5MWMyZDdjNzJiYTBiMGQ3ODg0
11
- MDA4NjQ0MzUzZDJkODMwNjY5NjhjMzBhZTIwNWUzN2EyMGFiOTU=
9
+ Zjk4ZmE1ODFlZjdkODUzOTA0Yzc4ZmE5OTkyNWRjNTBkNjgxNDdhZGUwODBi
10
+ ZmZhNzllOWViZDBiMGRjM2E5OTE0ZTQxNzc4NTIyNWE1YjgzZGFlMzFiMTUw
11
+ YWQ5NjUzZDNlZTMzNWJjZjdhMzE5MzUxNjZkOTU2ODVkNWU3OGQ=
12
12
  data.tar.gz: !binary |-
13
- Njk0MzJhODhkMTA4YjU0MmVkZDNjMmRjZTI1MGYxZGU1YmFhMTI5ODg1Yzgx
14
- MjVjNTEwMmFjYmQ2NzBkOGM3MjU5NDIzNGNjOTdjYWZmNTFlMjBjMjFlNDhi
15
- Y2NlNTQ3ZWUzM2RlMzc3NmE0OTg5NTM1Y2EyYmUzZTgzMmFlYWU=
13
+ MmJlZGU4MGJiZDQzMmRlYTVkYmQ5ZTUyYzRjMzhmZWEzMTJjNzZiMGFmNTU1
14
+ ODk5YzliYmIyNjhiZDgxZjY5ZDFjZmJhODc1Nzg3OTQ1MzUzZWExMzhhOTA1
15
+ NjNmYjI0OWM2OGFmNTBmNzRiZWYwMWQ0NDc1YTcyMjEzZmQ1YTI=
data/README.rdoc CHANGED
@@ -20,6 +20,7 @@ Shared methods and functions used by revs-indexer, pre-assembly and bulk metadat
20
20
  - <b>1.0.8</b> Update clean_collection_name method to deal with other possible names
21
21
  - <b>1.0.9</b> Add more common format corrections
22
22
  - <b>1.0.10</b> Update valid for metadata method so it is not sensitive to blank or uppercase columns
23
+ - <b>1.0.11</b> Fix issues with year parsing
23
24
 
24
25
  == Running tests
25
26
 
@@ -1,5 +1,5 @@
1
1
  module Revs
2
2
  module Utils
3
- VERSION = "1.0.10"
3
+ VERSION = "1.0.11"
4
4
  end
5
5
  end
data/lib/revs-utils.rb CHANGED
@@ -258,14 +258,14 @@ module Revs
258
258
  years_to_add=[]
259
259
  result.each do |year|
260
260
 
261
- 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]
261
+ 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]
262
262
  start_year=year[2..3]
263
263
  end_year=year[5..6]
264
264
  stem=year[0..1]
265
265
  for n in start_year..end_year
266
266
  years_to_add << "#{stem}#{n}"
267
267
  end
268
- 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]
268
+ 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]
269
269
  start_year=year[3..3]
270
270
  end_year=year[5..5]
271
271
  stem=year[0..2]
@@ -280,7 +280,7 @@ module Revs
280
280
  %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
281
281
  end
282
282
 
283
- 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]
283
+ 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]
284
284
  start_year=year[0..3]
285
285
  end_year=year[5..8]
286
286
  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
@@ -138,6 +138,12 @@ describe "Revs-Utils" do
138
138
 
139
139
  end
140
140
 
141
+ it "should parse 1800-1802" do
142
+
143
+ @revs.parse_years('1800-1802').should == ['1800','1801','1802']
144
+
145
+ end
146
+
141
147
  it "should parse 1955-1957 | 1955 | 1955 and not produce duplicate years" do
142
148
 
143
149
  @revs.parse_years('1955-1957 | 1955 | 1955').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: 1.0.10
4
+ version: 1.0.11
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-16 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: countries