pennmarc 1.0.17 → 1.0.18

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: 90b9c248dbc3c08377212a70748dcf13728c9feaa037a4a64cc398c02a36c3df
4
- data.tar.gz: f3c14ffea869113e6f94fc5d94ff5a083f2749cb17ed33854243131b134185a1
3
+ metadata.gz: 4f6b5628a407dc533c2f41b5c93d4b47239a36cc106c873b5bc7768825959451
4
+ data.tar.gz: 55db336dac7987be256abfec2830d72e9fc599346e49c2cc92c0cf61f7c810ff
5
5
  SHA512:
6
- metadata.gz: 25f98a210e26abc52edefb5614bf5ebbdb1acc04baaaaa3c0a770f284f8161f301a2fe768a336ee9291ba640f9251e71d68d39cd5d222707254b8ca5763261b6
7
- data.tar.gz: c0ee733d64114e1b5c317cd49ebedc330c2a179282be2cb43f3f9457d40253dd197da5fe18e6c09a04f945be1d43fa837a9920648ae8af439a3ad0fdcf23ee38
6
+ metadata.gz: 4e2c930016793ae39d206d55a574c3e26d329507f6be46cde19628bcf6f9cc55213fcc9e8c7866e3f031510261fbba1cd64e54fe429c1bb92f0cb9c9c03dc9f8
7
+ data.tar.gz: 2162e68b8aa887239e36333a9c1650a3f989cc1906b0c4271e419c4ad21a20e8cf2a19455fa3e77b8dbbf9bf4cdf4b9fdf6f99b6cfb61d68050d7362ae8867e3
@@ -214,7 +214,7 @@ module PennMARC
214
214
 
215
215
  return true if field.tag.in?(DISPLAY_TAGS) && field.indicator2.in?(%w[0 2 4])
216
216
 
217
- return true if field.indicator2 == '7' && valid_subject_genre_source_code?(field)
217
+ return true if field.tag.in?(DISPLAY_TAGS) && field.indicator2 == '7' && valid_subject_genre_source_code?(field)
218
218
 
219
219
  false
220
220
  end
@@ -254,8 +254,10 @@ module PennMARC
254
254
  term_info[:append] << subfield.value.strip # TODO: map relator code?
255
255
  when 'b', 'c', 'd', 'p', 'q', 't'
256
256
  # these are appended to the last component (part) if possible (i.e., when joined, should have no delimiter)
257
- # assume that there is an 'a' preceding value
258
- term_info[:parts].last << " #{subfield.value.strip}"
257
+ # if there is no preceding part then this is simply added to the parts array
258
+ to_append = " #{subfield.value.strip}"
259
+
260
+ term_info[:parts].empty? ? term_info[:parts] << subfield.value.strip : term_info[:parts].last << to_append
259
261
  term_info[:count] += 1
260
262
  else
261
263
  # the usual case; add a new component to `parts`
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.0.17'
4
+ VERSION = '1.0.18'
5
5
  end
@@ -128,6 +128,16 @@ describe 'PennMARC::Subject' do
128
128
  end
129
129
  end
130
130
 
131
+ context 'with a record with an invalid tag, but valid indicator2 and source specified' do
132
+ let(:fields) do
133
+ [marc_field(tag: '654', indicator2: '7', subfields: { c: 'b', a: 'Architectural theory', '2': 'aat' })]
134
+ end
135
+
136
+ it 'does not include the field' do
137
+ expect(values).to be_empty
138
+ end
139
+ end
140
+
131
141
  context 'with a record with trailing periods' do
132
142
  let(:fields) do
133
143
  [marc_field(tag: '600', indicator2: '0',
@@ -142,6 +152,16 @@ describe 'PennMARC::Subject' do
142
152
  'to be consistent in the Churches of Christ')
143
153
  end
144
154
  end
155
+
156
+ context 'with a record where a main subject part does not precede other subject parts' do
157
+ let(:fields) do
158
+ [marc_field(tag: '650', indicator2: '0', subfields: { b: 'Italian', a: 'Architectural theory' })]
159
+ end
160
+
161
+ it 'treats the first part it comes across as a main subject part' do
162
+ expect(values).to contain_exactly('Italian--Architectural theory')
163
+ end
164
+ end
145
165
  end
146
166
 
147
167
  describe '.show' do
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.17
4
+ version: 1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kanning
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-04-12 00:00:00.000000000 Z
13
+ date: 2024-04-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport