stanford-mods 2.5.0 → 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stanford-mods/imprint.rb +5 -3
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/imprint_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0228a5039c07e8a14dc5b3e3c2ab8406695335ab'
|
4
|
+
data.tar.gz: 4ab66f765c29758620f0d30d4d94916ec19bd873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b93ffbd727cb1b2981aecfc859afc3e736186b84fb0e6286b56d297132a2abbba86b8f06251e869b070f54c7b5b74c31a0b32c505008c7f8a7baee12079b6513
|
7
|
+
data.tar.gz: 74d357cfe005638a9f4292f7340b492aec00b4854562a01bda30b8355b5fa9d94ce08d4c7515a9a4e5b9e91c1ef48493436b97fa7d4f187524fae8baf8c912b4
|
@@ -40,7 +40,6 @@ module Stanford
|
|
40
40
|
# @return Array<Integer> an array of publication years for the resource
|
41
41
|
def publication_date_for_slider
|
42
42
|
@originInfo_ng_nodeset.map do |origin_info_node|
|
43
|
-
|
44
43
|
date_elements = if origin_info_node.as_object.first.key_dates.any?
|
45
44
|
origin_info_node.as_object.first.key_dates.map(&:as_object).map(&:first)
|
46
45
|
else
|
@@ -53,12 +52,15 @@ module Stanford
|
|
53
52
|
|
54
53
|
if date_elements.nil? || date_elements.none?
|
55
54
|
[]
|
56
|
-
elsif date_elements.find(&:start?) &&
|
55
|
+
elsif date_elements.find(&:start?) &&
|
56
|
+
date_elements.find(&:start?).as_range &&
|
57
|
+
date_elements.find(&:end?) &&
|
58
|
+
date_elements.find(&:end?).as_range
|
57
59
|
start_date = date_elements.find(&:start?)
|
58
60
|
end_date = date_elements.find(&:end?)
|
59
61
|
|
60
62
|
(start_date.as_range.min.year..end_date.as_range.max.year).to_a
|
61
|
-
elsif date_elements.find(&:start?)
|
63
|
+
elsif date_elements.find(&:start?) && date_elements.find(&:start?).as_range
|
62
64
|
start_date = date_elements.find(&:start?)
|
63
65
|
|
64
66
|
(start_date.as_range.min.year..Time.now.year).to_a
|
data/spec/imprint_spec.rb
CHANGED
@@ -12,6 +12,7 @@ describe Stanford::Mods::Imprint do
|
|
12
12
|
describe '#publication_date_for_slider' do
|
13
13
|
{
|
14
14
|
'' => [],
|
15
|
+
'<dateIssued point="start">unparsable</dateIssued>' => [],
|
15
16
|
'<dateIssued>1957</dateIssued>' => [1957],
|
16
17
|
'<dateIssued>195u</dateIssued>' => (1950..1959).to_a,
|
17
18
|
'<dateCreated keyDate="yes">1964</dateCreated><dateIssued>195u</dateIssued>' => [1964],
|