pennmarc 1.0.27 → 1.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pennmarc/enriched.rb +1 -1
- data/lib/pennmarc/helpers/identifier.rb +1 -1
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/identifer_spec.rb +30 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '07810ba2a6de07713ce40a1cfbe7fc33d5497eec834011a0098ce2cbd74bc5ff'
|
4
|
+
data.tar.gz: 45c3f0002e46be338a63be2109153f7603d9ebf8b1814d825b4c889c7f7237b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a214837d1f061611a13ea7d09b13ae41d7f6f7df8f08d03da3d98d8969849aacb0edfd45a3fea231acb1e53f8c06c4e4793db49cf5274063d6c59d7b7043212
|
7
|
+
data.tar.gz: 1a6dd99e562ef38b301e49ac17b6ec211eb0af1e7bdccc6a0d98c15683163f9c4168e51b8560296282a42d6dacdbfbb5d8856628af7000614e48961cbcb6b19c
|
data/lib/pennmarc/enriched.rb
CHANGED
@@ -12,7 +12,7 @@ module PennMARC
|
|
12
12
|
PHYS_INVENTORY_TAG = 'hld'
|
13
13
|
ELEC_INVENTORY_TAG = 'prt'
|
14
14
|
ITEM_TAG = 'itm'
|
15
|
-
|
15
|
+
RELATED_RECORD_TAGS = %w[REL rel].freeze
|
16
16
|
|
17
17
|
# Subfields for HLD tags
|
18
18
|
# Follow MARC 852 spec: https://www.loc.gov/marc/holdings/hd852.html, but names are translated into Alma parlance
|
@@ -164,7 +164,7 @@ module PennMARC
|
|
164
164
|
# @param [MARC::Record] record
|
165
165
|
# @return [Array<String>]
|
166
166
|
def host_record_id(record)
|
167
|
-
record.fields(Enriched::Pub::
|
167
|
+
record.fields(Enriched::Pub::RELATED_RECORD_TAGS).filter_map { |field|
|
168
168
|
next unless subfield_value?(field, 'c', /contains/i)
|
169
169
|
|
170
170
|
subfield_values field, :w
|
data/lib/pennmarc/version.rb
CHANGED
@@ -161,16 +161,36 @@ describe 'PennMARC::Identifier' do
|
|
161
161
|
end
|
162
162
|
|
163
163
|
describe '.host_record_id' do
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
164
|
+
context 'with a lower case tag' do
|
165
|
+
let(:record) do
|
166
|
+
marc_record fields: [
|
167
|
+
marc_field(tag: PennMARC::Enriched::Pub::RELATED_RECORD_TAGS.second, subfields: { w: '123456789',
|
168
|
+
c: 'Contains',
|
169
|
+
a: 'Title' }),
|
170
|
+
marc_field(tag: PennMARC::Enriched::Pub::RELATED_RECORD_TAGS.second, subfields: { w: '666666666',
|
171
|
+
c: 'Contained In' })
|
172
|
+
]
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'returns only the desired host record MMS ID values' do
|
176
|
+
expect(helper.host_record_id(record)).to contain_exactly '123456789'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'with an upper case tag' do
|
181
|
+
let(:record) do
|
182
|
+
marc_record fields: [
|
183
|
+
marc_field(tag: PennMARC::Enriched::Pub::RELATED_RECORD_TAGS.first, subfields: { w: '123456789',
|
184
|
+
c: 'Contains',
|
185
|
+
a: 'Title' }),
|
186
|
+
marc_field(tag: PennMARC::Enriched::Pub::RELATED_RECORD_TAGS.first, subfields: { w: '666666666',
|
187
|
+
c: 'Contained In' })
|
188
|
+
]
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'returns only the desired host record MMS ID values' do
|
192
|
+
expect(helper.host_record_id(record)).to contain_exactly '123456789'
|
193
|
+
end
|
174
194
|
end
|
175
195
|
end
|
176
196
|
end
|
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.0.
|
4
|
+
version: 1.0.30
|
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: 2024-07-
|
15
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|