pennmarc 1.4.13 → 1.5.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef3dc2e703536d342d55adee946f7ff062f608d8eb9fde3cf94f96c13370e06f
4
- data.tar.gz: b98eeb2932eb8e1f2f353479748071f11988bae0d4f4b3946a3b4367f97a99a1
3
+ metadata.gz: dcc109123084f574bef4157fed192262a5d14ddc4f143acd96994b43512ac7ff
4
+ data.tar.gz: 8a71fceb7682a55e157455a2a3c90c13e8b9b915ad480e735df54b4170a6aeb2
5
5
  SHA512:
6
- metadata.gz: 7c29038b83ce92f6d95168e1d0268f6d3a27c30d4baa7f3fa13c5a2257b8e91b705bc8d921eec6cb9ab3f979c1311a098699acaa33d16b9f9b87d9a8820d8333
7
- data.tar.gz: 304937c1e2146d111dd314d64b6d5d78a942a3b9fbe6cd987ccc6e4f6c38937543bd67e6b3b17028d94c39d4fe8bc1f903ebec83da221d7e579dc77cb4fe3336
6
+ metadata.gz: 1cd2813eec3614536eddffaf0f69caa104da3f38fec9e066fc489c24b148a902ed93dc3271595fc9e2d28cf90d076bb82384ec783ab3f530105223219698865b
7
+ data.tar.gz: 1a1801e36c0b03ec8b37de9a76518dd3c79aa7333590ecdc9ec6b4a86064dacdff180295d666a1c98fe7476062d174a3ad4f421ea85ee59aefa24d0aa7a4930d
@@ -18,7 +18,7 @@ module PennMARC
18
18
  editions = record.fields('250').map do |field|
19
19
  join_subfields(field, &subfield_not_in?(%w[6 7 8]))
20
20
  end
21
- editions += linked_alternate_not_6_or_8(record, '250') if with_alternate
21
+ editions += linked_alternate_not_6_7_8(record, '250') if with_alternate
22
22
 
23
23
  editions.uniq
24
24
  end
data/lib/pennmarc/util.rb CHANGED
@@ -194,27 +194,26 @@ module PennMARC
194
194
  end
195
195
  end
196
196
 
197
- # Common case of wanting to extract all the subfields besides 6 or 8,
198
- # from 880 datafield that has a particular subfield 6 value. We exclude 6 because
199
- # that value is the linkage ID itself and 8 because... IDK
197
+ # Common case of wanting to extract all the subfields besides 6, 7 or 8,
198
+ # from 880 datafield that has a particular subfield 6 value.
200
199
  # @param record [MARC::Record]
201
200
  # @param subfield6_value [String, Array] either a string to look for in sub6 or an array of them
202
201
  # @return [Array] array of linked alternates without 8 or 6 values
203
- def linked_alternate_not_6_or_8(record, subfield6_value)
204
- excluded_subfields = %w[6 8]
202
+ def linked_alternate_not_6_7_8(record, subfield6_value)
203
+ excluded_subfields = %w[6 7 8]
205
204
  linked_alternate(record, subfield6_value) do |sf|
206
205
  excluded_subfields.exclude?(sf.code)
207
206
  end
208
207
  end
209
208
 
210
- # Returns the non-6,8 subfields from a datafield and its 880 link.
209
+ # Returns the non-6,7,8 subfields from a datafield and its 880 link.
211
210
  # @param record [MARC::Record]
212
211
  # @param tag [String]
213
212
  # @return [Array<String>] values
214
213
  def datafield_and_linked_alternate(record, tag)
215
214
  record.fields(tag).filter_map { |field|
216
- join_subfields(field, &subfield_not_in?(%w[6 8]))
217
- } + linked_alternate_not_6_or_8(record, tag)
215
+ join_subfields(field, &subfield_not_in?(%w[6 7 8]))
216
+ } + linked_alternate_not_6_7_8(record, tag)
218
217
  end
219
218
 
220
219
  # Get the substring of a string up to a given target character
@@ -283,7 +282,7 @@ module PennMARC
283
282
  next unless field.any? { |sf| sf.code == 'a' && sf.value =~ /^(#{prefix}|%#{prefix})/ }
284
283
 
285
284
  elements = field.select(&subfield_in?(%w[a])).map { |sf| sf.value.gsub(/^%?#{prefix}/, '') }
286
- elements << join_subfields(field, &subfield_not_in?(%w[a 6 8 e w 5]))
285
+ elements << join_subfields(field, &subfield_not_in?(%w[a 6 7 8 e w 5]))
287
286
  join_and_squish elements
288
287
  }.uniq
289
288
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.4.13'
4
+ VERSION = '1.5.0'
5
5
  end
@@ -142,11 +142,12 @@ describe 'PennMARC::Util' do
142
142
  describe '.linked_alternate_not_6_or_8' do
143
143
  let(:record) do
144
144
  marc_record fields: [marc_field(tag: '510', subfields: { a: 'Perkins', b: 'Test' }),
145
- marc_field(tag: '880', subfields: { '6': '510', '8': 'Ignore', a: 'Snikrep', b: 'Tset' })]
145
+ marc_field(tag: '880', subfields: { '6': '510', '7': 'blah', '8': 'Ignore', a: 'Snikrep',
146
+ b: 'Tset' })]
146
147
  end
147
148
 
148
- it 'returns the linked alternate without 6 or 8' do
149
- expect(util.linked_alternate_not_6_or_8(record, '510')).to contain_exactly('Snikrep Tset')
149
+ it 'returns the linked alternate without 6, 7 or 8' do
150
+ expect(util.linked_alternate_not_6_7_8(record, '510')).to contain_exactly('Snikrep Tset')
150
151
  end
151
152
  end
152
153
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pennmarc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.13
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kanning
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2026-11-12 00:00:00.000000000 Z
15
+ date: 2026-11-13 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport