neu-mods 0.7.0 → 0.7.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/lib/neu/mods/projection.rb +8 -11
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afd81033ef60fdd497880f538d3730d1518a37b362307028a165a1f93105bdd2
4
- data.tar.gz: 3f6e1aa77c231d6622dceb4d4ae66d500329776659bf4feb2cb4ea8ded455932
3
+ metadata.gz: d7e678073c1e18b2626473e1e8fcec32052a2a33075d34cea6fe96dca40e8315
4
+ data.tar.gz: 5d3d44f6bf9ee5600dfdaded3a9d2119472e86c1aa6621fbcd92ea8358619738
5
5
  SHA512:
6
- metadata.gz: 6b643273728275f712a266a33a64cf34bbe078fa405ca29ffd59af52f0e9ee7c9102f3867f6d4129bcbb5b050d28c9a00995190ec5568fea6761ee1af87254c4
7
- data.tar.gz: b86248e24362d8e1436c47c4a0decf5254207ad587791f8fb0434ac7560e4d7a79e3e429464d89ad50dcc92d208e63ad456235a0c94a6c328b7b6efc0951d22f
6
+ metadata.gz: ce304892f19636ecc57c487810a2ef2932f253d9702dcce6974a16c8e047b56ceeffb3ae25750bf2e5937345523567dd9d598ef59c32e671dcc80d62541748c8
7
+ data.tar.gz: a31247bacadff8b81b4789c2dc69647b2036b98e246af02492d1ecdfb14e1a625e1deb2f7c7ad7afff5298d531a6b6bcacfa803ab3ea7629ecea623e45e06667
data/.version CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -116,9 +116,7 @@ module NEU
116
116
 
117
117
  # Every <topic> under any top-level <subject> (the access-copy projection,
118
118
  # equivalent to Atlas's extract_topical_subjects).
119
- def topical_subjects
120
- doc.xpath("/mods:mods/mods:subject/mods:topic", NAMESPACE).map { |t| clean(t.text) }
121
- end
119
+ def topical_subjects = texts_at("/mods:mods/mods:subject/mods:topic")
122
120
 
123
121
  # The other subject axes. Cerberus's IPTC ingest writes subject/geographic
124
122
  # from the IPTC City and State fields, so this one was also being written
@@ -190,9 +188,7 @@ module NEU
190
188
  def extent = texts_at("/mods:mods/mods:physicalDescription/mods:extent")
191
189
  def digital_origin = texts_at("/mods:mods/mods:physicalDescription/mods:digitalOrigin")
192
190
 
193
- def genres
194
- doc.xpath("/mods:mods/mods:genre", NAMESPACE).map { |g| clean(g.text) }
195
- end
191
+ def genres = texts_at("/mods:mods/mods:genre")
196
192
 
197
193
  # originInfo repeats, and so do publisher and edition within one. Cerberus's
198
194
  # IPTC ingest writes the publisher from the IPTC Source field on every batch,
@@ -263,9 +259,7 @@ module NEU
263
259
  end
264
260
  end
265
261
 
266
- def identifiers
267
- doc.xpath("/mods:mods/mods:identifier", NAMESPACE).map { |i| clean(i.text) }
268
- end
262
+ def identifiers = texts_at("/mods:mods/mods:identifier")
269
263
 
270
264
  def permanent_url
271
265
  node = doc.at_xpath("/mods:mods/mods:identifier[@type='hdl']", NAMESPACE)
@@ -467,8 +461,11 @@ module NEU
467
461
  node ? NEU::MODS.canonical_ws(node.text) : ""
468
462
  end
469
463
 
470
- # The :many counterpart of #text_at. Blank members drop out rather than
471
- # arriving as nil, so a consumer mapping over the array cannot trip on one.
464
+ # The :many counterpart of #text_at, and the one way this file builds a
465
+ # string array. Blank members drop out rather than arriving as nil: a
466
+ # record template that seeds an empty <topic> for an edit form to fill --
467
+ # which is exactly what Atlas's MODSBuilder writes -- otherwise projects
468
+ # [nil], and every consumer of that array has to guard for it.
472
469
  def texts_at(xpath)
473
470
  doc.xpath(xpath, NAMESPACE).filter_map { |node| clean(node.text) }
474
471
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neu-mods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cliff