stanford-mods 3.3.2 → 3.3.4

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
  SHA256:
3
- metadata.gz: 33e5860d1c199fb9d7da0e55e49ccad107ee9438fd2b21f80008bdfb4a807ee5
4
- data.tar.gz: 86a3a03dab961a6717f5bd96ca9f603aff70114549f38dda13ef2743b1d3543b
3
+ metadata.gz: 5fa228dc93f0f24e8f5c5b9b96106761ef03fcb2ad25fe2c9083fb6d1025a1a5
4
+ data.tar.gz: eb507bdb0c5d07dc0b2d6aa6f5b4132d54f5d1fbeac528a91eb5ea2c97c3ad17
5
5
  SHA512:
6
- metadata.gz: fdb0d00f24950da177f470afd6339aa36e4dc6db460e4746b3321a9bad91202ff8becffbecf9875271a43f039a3a71d91c1c3e9c76bd1eaa2a202fdb61c2d5a9
7
- data.tar.gz: 331d43a66da3c06ea5a3312043db2e15c90edbe2166cc2b1f3d0c48b02088885274e18cc78b314132bd359431a5a0da69261d89bd55c5b24114f7c3cd7fa8ffc
6
+ metadata.gz: b6bd720575deaefb97c80bacbddde3a2c9e6b8d48c469575ec22a04dbbf5f1ec6fc18c48951a4ff45619ed6c305608c4e954bc4d07b87201d825ae13c4dee7ce
7
+ data.tar.gz: ce40138bb0489021788b64f08fc689bd23ce7c376fde6f8b9a5d897b57a3c7205c023e5b09834495ec9557a75f1efab68a484cae30df0140be074d6097bbf432
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby: [jruby-9.3.2.0, 2.7, '3.0', '3.1']
14
+ ruby: ['3.1', '3.2']
15
15
  steps:
16
16
  - uses: actions/checkout@v2
17
17
  - name: Set up Ruby
@@ -27,6 +27,9 @@ module Stanford
27
27
 
28
28
  edtf_date = date.date
29
29
 
30
+ # Protect against cases in which Date.edtf returns nil (e.g., 1uuu)
31
+ return unless edtf_date
32
+
30
33
  if edtf_date.is_a?(EDTF::Interval)
31
34
  edtf_date.from.year
32
35
  else
@@ -9,7 +9,7 @@ module Stanford
9
9
  mods_ng_xml.language.flat_map do |n|
10
10
  # get languageTerm codes and add their translations to the result
11
11
  result = n.code_term.flat_map do |ct|
12
- if ct.authority =~ /^iso639/
12
+ if ct.authority.to_s =~ /^iso639/
13
13
  vals = ct.text.split(/[,|\ ]/).reject { |x| x.strip.empty? }
14
14
  vals.select { |v| ISO_639.find(v.strip) }.map do |v|
15
15
  iso639_val = ISO_639.find(v.strip).english_name
@@ -114,11 +114,11 @@ module Stanford
114
114
  val.uniq
115
115
  end
116
116
 
117
- # @return [String] value with the numeric catkey in it, or nil if none exists
117
+ # @return [String] value with the catkey in it, or nil if none exists
118
118
  def catkey
119
119
  catkey = term_values([:record_info, :recordIdentifier])
120
120
 
121
- catkey.first&.tr('a', '') # ensure catkey is numeric only
121
+ catkey.first&.tr('a', '') # remove prefix from SUL catkeys
122
122
  end
123
123
  end # class Record
124
124
  end # Module Mods
@@ -1,6 +1,6 @@
1
1
  module Stanford
2
2
  module Mods
3
3
  # this is the Ruby Gem version
4
- VERSION = '3.3.2'.freeze
4
+ VERSION = '3.3.4'.freeze
5
5
  end
6
6
  end
@@ -318,6 +318,22 @@ describe "computations from /originInfo field" do
318
318
  expect(record.pub_year_display_str).to eq nil
319
319
  end
320
320
  end
321
+
322
+ context 'with a date not handled by EDTF' do
323
+ let(:modsxml) do
324
+ <<-EOF
325
+ <mods xmlns="http://www.loc.gov/mods/v3">
326
+ <originInfo>
327
+ <dateIssued encoding="marc">1uuu</dateIssued>
328
+ </originInfo>
329
+ </mods>
330
+ EOF
331
+ end
332
+
333
+ it 'ignores the date' do
334
+ expect(record.pub_year_display_str).to eq nil
335
+ end
336
+ end
321
337
  end
322
338
 
323
339
  context '#pub_year_sort_str' do
@@ -13,7 +13,7 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
13
13
  expect(langs.size).to eq(3)
14
14
  expect(langs).to include("Persian", "Arabic", "Dutch")
15
15
  expect(langs).not_to include("Dutch; Flemish")
16
- end
16
+ end
17
17
  it "should return a language string from lookup for a valid language code that has a type=code specified but no authority" do
18
18
  m = "<mods #{@ns_decl}> <language><languageTerm type='code'>eng</languageTerm></language></mods>"
19
19
  @smods_rec.from_str m
@@ -63,6 +63,13 @@ describe "Searchworks mixin for Stanford::Mods::Record" do
63
63
  expect(langs.size).to eq 1
64
64
  expect(langs).to include "English"
65
65
  end
66
+ it "handles codes without authority elements" do
67
+ m = "<mods #{@ns_decl}><language><languageTerm type='code'>eng</languageTerm></language></mods>"
68
+ @smods_rec.from_str m
69
+ langs = @smods_rec.sw_language_facet
70
+ expect(langs.size).to eq 1
71
+ expect(langs).to include "English"
72
+ end
66
73
  end
67
74
 
68
75
  context "sw author methods" do
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: 3.3.2
4
+ version: 3.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-02-15 00:00:00.000000000 Z
12
+ date: 2023-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mods
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []
217
- rubygems_version: 3.3.26
217
+ rubygems_version: 3.3.7
218
218
  signing_key:
219
219
  specification_version: 4
220
220
  summary: Stanford specific wrangling of MODS metadata