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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59b15047f00caeb2284b28a22050e1656a8237ad
4
- data.tar.gz: 43e5403241eeac0a90a17ec06fc2d80f4588a39e
3
+ metadata.gz: '0228a5039c07e8a14dc5b3e3c2ab8406695335ab'
4
+ data.tar.gz: 4ab66f765c29758620f0d30d4d94916ec19bd873
5
5
  SHA512:
6
- metadata.gz: 5c6ca8c2716fd12e10d5097569c47e02fab1cb6d9bf83bd02568239498432596ec7ef4b8ddafb2e8045a846bc56e6fd47804319f61e2c175db8427aedeb4eafa
7
- data.tar.gz: 1c25481b485b3ff62288a2577241c5198d839c5d361e03b33560ab7de54f719e6e6b97f9dd31452a823af122dbed6998932a421ff54d127382e990c34396457d
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?) && date_elements.find(&:end?)
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
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = "2.5.0".freeze
4
+ VERSION = "2.5.1".freeze
5
5
  end
6
6
  end
@@ -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],
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stanford-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay