pennmarc 1.0.9 → 1.0.10
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 +4 -4
- data/lib/pennmarc/helpers/database.rb +3 -3
- data/lib/pennmarc/helpers/link.rb +2 -2
- data/lib/pennmarc/helpers/note.rb +5 -4
- data/lib/pennmarc/helpers/series.rb +2 -2
- data/lib/pennmarc/helpers/title.rb +3 -3
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/database_spec.rb +10 -10
- data/spec/lib/pennmarc/helpers/link_spec.rb +6 -6
- data/spec/lib/pennmarc/helpers/note_spec.rb +2 -0
- data/spec/lib/pennmarc/helpers/series_spec.rb +8 -8
- data/spec/lib/pennmarc/helpers/title_spec.rb +6 -6
- 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: 27d9b9618c0824c62064d486d486850948dd079dd9667c2955cc7c04556e4656
|
4
|
+
data.tar.gz: d741e303841db97060e8747e751ebfa79e3b37b9391eec6ab072d71cb560267a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b165a655fc431225d39004be0470e35760a41d62693455a63c2e6b6f346391803fdd7955b418b890a7531eb45b3a687fb5f9a5cd0a8aecce884ae3f8d2b82f
|
7
|
+
data.tar.gz: 01cfac580c76988881af4b639957f6351db48f6998947b84e68aa3450c9c905bef9c04c5895489db063296d8e7810c332218fb5cf36ff42b3f4bb5cb519ea098
|
@@ -18,7 +18,7 @@ module PennMARC
|
|
18
18
|
# local field 944}. Only returns database subtype if Penn's Database facet value is present in subfield 'a'.
|
19
19
|
# @param [Marc::Record]
|
20
20
|
# @return [Array<string>] Array of types
|
21
|
-
def
|
21
|
+
def type_facet(record)
|
22
22
|
record.fields('944').filter_map do |field|
|
23
23
|
# skip unless specified database format type present
|
24
24
|
next unless subfield_value?(field, 'a', /#{DATABASES_FACET_VALUE}/o)
|
@@ -34,7 +34,7 @@ module PennMARC
|
|
34
34
|
# subfield '2'.
|
35
35
|
# @param [Marc::Record]
|
36
36
|
# @return [Array<string>] Array of categories
|
37
|
-
def
|
37
|
+
def category_facet(record)
|
38
38
|
return [] unless curated_db?(record)
|
39
39
|
|
40
40
|
record.fields('943').filter_map do |field|
|
@@ -55,7 +55,7 @@ module PennMARC
|
|
55
55
|
# an empty array.
|
56
56
|
# @param [Marc::Record]
|
57
57
|
# @return [Array<string>] Array of "category--subcategory"
|
58
|
-
def
|
58
|
+
def subcategory_facet(record)
|
59
59
|
return [] unless curated_db?(record)
|
60
60
|
|
61
61
|
record.fields('943').filter_map do |field|
|
@@ -13,7 +13,7 @@ module PennMARC
|
|
13
13
|
# Full text links from MARC 856 fields.
|
14
14
|
# @param [MARC::Record] record
|
15
15
|
# @return [Array] array of hashes
|
16
|
-
def
|
16
|
+
def full_text_links(record)
|
17
17
|
indicator2_options = %w[0 1]
|
18
18
|
links_from_record(record, indicator2_options)
|
19
19
|
end
|
@@ -21,7 +21,7 @@ module PennMARC
|
|
21
21
|
# Web text links from MARC 856 fields.
|
22
22
|
# @param [MARC::Record] record
|
23
23
|
# @return [Array] array of hashes
|
24
|
-
def
|
24
|
+
def web_links(record)
|
25
25
|
indicator2_options = ['2', ' ', '']
|
26
26
|
links_from_record(record, indicator2_options)
|
27
27
|
end
|
@@ -6,15 +6,16 @@ module PennMARC
|
|
6
6
|
class << self
|
7
7
|
# Retrieve notes for display from fields {https://www.oclc.org/bibformats/en/5xx/500.html 500},
|
8
8
|
# {https://www.oclc.org/bibformats/en/5xx/502.html 502}, {https://www.oclc.org/bibformats/en/5xx/504.html 504},
|
9
|
-
# {https://www.oclc.org/bibformats/en/5xx/515.html 515}, {https://www.oclc.org/bibformats/en/5xx/518.html 518}
|
9
|
+
# {https://www.oclc.org/bibformats/en/5xx/515.html 515}, {https://www.oclc.org/bibformats/en/5xx/518.html 518},
|
10
10
|
# {https://www.oclc.org/bibformats/en/5xx/525.html 525}, {https://www.oclc.org/bibformats/en/5xx/533.html 533},
|
11
|
-
# {https://www.oclc.org/bibformats/en/5xx/
|
12
|
-
# {https://www.oclc.org/bibformats/en/5xx/
|
11
|
+
# {https://www.oclc.org/bibformats/en/5xx/540.html 540}, {https://www.oclc.org/bibformats/en/5xx/550.html 550},
|
12
|
+
# {https://www.oclc.org/bibformats/en/5xx/580.html 580}, {https://www.oclc.org/bibformats/en/5xx/586.html 586},
|
13
|
+
# {https://www.oclc.org/bibformats/en/5xx/588.html 588}
|
13
14
|
# and their linked alternates.
|
14
15
|
# @param [MARC::Record] record
|
15
16
|
# @return [Array<String>]
|
16
17
|
def notes_show(record)
|
17
|
-
notes_fields = %w[500 502 504 515 518 525 533 550 580 586 588]
|
18
|
+
notes_fields = %w[500 502 504 515 518 525 533 540 550 580 586 588]
|
18
19
|
record.fields(notes_fields + ['880']).filter_map do |field|
|
19
20
|
next if field.tag == '880' && subfield_value_not_in?(field, '6', notes_fields)
|
20
21
|
|
@@ -84,7 +84,7 @@ module PennMARC
|
|
84
84
|
# https://www.loc.gov/marc/bibliographic/bd780.html
|
85
85
|
# @param [MARC::Record] record
|
86
86
|
# @return [String] continues fields string
|
87
|
-
def
|
87
|
+
def get_continues_show(record)
|
88
88
|
continues(record, '780')
|
89
89
|
end
|
90
90
|
|
@@ -94,7 +94,7 @@ module PennMARC
|
|
94
94
|
# https://www.loc.gov/marc/bibliographic/bd785.html
|
95
95
|
# @param [MARC::Record] record
|
96
96
|
# @return [String] continued by fields string
|
97
|
-
def
|
97
|
+
def get_continued_by_show(record)
|
98
98
|
continues(record, '785')
|
99
99
|
end
|
100
100
|
|
@@ -149,7 +149,7 @@ module PennMARC
|
|
149
149
|
# title browse and we will not be supporting that at this time
|
150
150
|
# @param [MARC::Record] record
|
151
151
|
# @return [Array<String>] Array of standardized titles as strings
|
152
|
-
def
|
152
|
+
def standardized_show(record)
|
153
153
|
standardized_titles = record.fields(%w[130 240]).map do |field|
|
154
154
|
join_subfields(field, &subfield_not_in?(%w[0 6 8 e w]))
|
155
155
|
end
|
@@ -177,7 +177,7 @@ module PennMARC
|
|
177
177
|
#
|
178
178
|
# @param [MARC::Record] record
|
179
179
|
# @return [Array<String>] Array of other titles as strings
|
180
|
-
def
|
180
|
+
def other_show(record)
|
181
181
|
other_titles = record.fields('246').map do |field|
|
182
182
|
join_subfields(field, &subfield_not_in?(%w[6 8]))
|
183
183
|
end
|
@@ -202,7 +202,7 @@ module PennMARC
|
|
202
202
|
# @todo what are e and w subfields?
|
203
203
|
# @param [MARC::Record] record
|
204
204
|
# @return [Array<String>] array of former titles
|
205
|
-
def
|
205
|
+
def former_show(record)
|
206
206
|
record.fields
|
207
207
|
.filter_map do |field|
|
208
208
|
next unless field.tag == '247' || (field.tag == '880' && subfield_value?(field, '6', /^247/))
|
data/lib/pennmarc/version.rb
CHANGED
@@ -21,39 +21,39 @@ describe 'PennMARC::Database' do
|
|
21
21
|
])
|
22
22
|
end
|
23
23
|
|
24
|
-
describe '.
|
24
|
+
describe '.type_facet' do
|
25
25
|
it 'returns database types' do
|
26
|
-
expect(helper.
|
27
|
-
|
26
|
+
expect(helper.type_facet(record)).to contain_exactly('Dictionaries and Thesauri (language based)',
|
27
|
+
'Reference and Handbooks')
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'with uncurated database' do
|
31
31
|
it 'returns empty array' do
|
32
|
-
expect(helper.
|
32
|
+
expect(helper.type_facet(record_uncurated_db)).to be_empty
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
describe '.
|
37
|
+
describe '.category_facet' do
|
38
38
|
it 'returns database categories' do
|
39
|
-
expect(helper.
|
39
|
+
expect(helper.category_facet(record)).to contain_exactly('Humanities', 'Social Sciences')
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'with uncurated database' do
|
43
43
|
it 'returns empty array' do
|
44
|
-
expect(helper.
|
44
|
+
expect(helper.category_facet(record_uncurated_db)).to be_empty
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe '.
|
49
|
+
describe '.subcategory_facet' do
|
50
50
|
it 'returns database subcategories' do
|
51
|
-
expect(helper.
|
51
|
+
expect(helper.subcategory_facet(record)).to contain_exactly('Social Sciences--Linguistics')
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'with uncurated database' do
|
55
55
|
it 'returns empty array' do
|
56
|
-
expect(helper.
|
56
|
+
expect(helper.subcategory_facet(record_uncurated_db)).to be_empty
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -5,7 +5,7 @@ describe 'PennMARC::Link' do
|
|
5
5
|
|
6
6
|
let(:helper) { PennMARC::Link }
|
7
7
|
|
8
|
-
describe '.
|
8
|
+
describe '.full_text_link' do
|
9
9
|
let(:record) do
|
10
10
|
marc_record fields: [marc_field(tag: '856', subfields: { '3': 'Materials specified',
|
11
11
|
z: 'Public note',
|
@@ -15,12 +15,12 @@ describe 'PennMARC::Link' do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'returns full text link text and url' do
|
18
|
-
expect(helper.
|
19
|
-
|
18
|
+
expect(helper.full_text_link(record)).to contain_exactly({ link_text: 'Materials specified Public note',
|
19
|
+
link_url: 'https://www.test-uri.com/' })
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe '.
|
23
|
+
describe '.web_link' do
|
24
24
|
let(:record) do
|
25
25
|
marc_record fields: [marc_field(tag: '856', subfields: { '3': 'Materials specified',
|
26
26
|
z: 'Public note',
|
@@ -30,8 +30,8 @@ describe 'PennMARC::Link' do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'returns web link text and url' do
|
33
|
-
expect(helper.
|
34
|
-
|
33
|
+
expect(helper.web_link(record)).to contain_exactly({ link_text: 'Materials specified Public note',
|
34
|
+
link_url: 'https://www.test-uri.com/' })
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -18,6 +18,7 @@ describe 'PennMARC::Note' do
|
|
18
18
|
b: 'UK', c: 'Historical Association',
|
19
19
|
d: '1917', e: '434 reels',
|
20
20
|
f: '(Seized records)' }),
|
21
|
+
marc_field(tag: '540', subfields: { a: 'Restricted: Copying allowed only for nonprofit organizations' }),
|
21
22
|
marc_field(tag: '588', subfields: { a: 'Print version record', '5': 'LoC' }),
|
22
23
|
marc_field(tag: '880', subfields: { b: 'Alt PhD', c: 'Alt UPenn', d: 'Alt 2021', '6': '502' }),
|
23
24
|
marc_field(tag: '880', subfields: { b: 'Ignore Note', '6': '501' })
|
@@ -32,6 +33,7 @@ describe 'PennMARC::Note' do
|
|
32
33
|
'PhD University of Pennsylvania 2021',
|
33
34
|
'Includes bibliographical references (pages 329-[342]) and index.',
|
34
35
|
'Archives Microfilm UK Historical Association 1917 434 reels (Seized records)',
|
36
|
+
'Restricted: Copying allowed only for nonprofit organizations',
|
35
37
|
'Print version record', 'Alt PhD Alt UPenn Alt 2021')
|
36
38
|
end
|
37
39
|
end
|
@@ -18,7 +18,7 @@ describe 'PennMARC::Series' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '.show' do
|
21
|
-
it 'returns the series' do
|
21
|
+
it 'returns the series values for display' do
|
22
22
|
expect(helper.show(record, relator_map: mapping)).to contain_exactly(
|
23
23
|
'Bean Bagatolvski 1997- bk. 1',
|
24
24
|
'Teachings of the feathered pillow',
|
@@ -28,7 +28,7 @@ describe 'PennMARC::Series' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe '.values' do
|
31
|
-
it 'returns the values' do
|
31
|
+
it 'returns the series values' do
|
32
32
|
expect(helper.values(record, relator_map: mapping)).to contain_exactly('Bean Bagatolvski 1997- bk. 1.')
|
33
33
|
end
|
34
34
|
end
|
@@ -43,15 +43,15 @@ describe 'PennMARC::Series' do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe '.
|
47
|
-
it 'gets continues for display' do
|
48
|
-
expect(helper.
|
46
|
+
describe '.get_continues_show' do
|
47
|
+
it 'gets continues values for display' do
|
48
|
+
expect(helper.get_continues_show(record)).to contain_exactly('National Comfort Association')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe '.
|
53
|
-
it 'gets continued by display' do
|
54
|
-
expect(helper.
|
52
|
+
describe '.get_continued_by_show' do
|
53
|
+
it 'gets continued by values for display' do
|
54
|
+
expect(helper.get_continued_by_show(record)).to contain_exactly('NCA quarterly comfortology bulletin')
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
@@ -195,7 +195,7 @@ describe 'PennMARC::Title' do
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
-
describe '.
|
198
|
+
describe '.standardized_show' do
|
199
199
|
let(:record) do
|
200
200
|
marc_record fields: [
|
201
201
|
marc_field(tag: '130', subfields: { a: 'Uniform Title', f: '2000', '8': 'Not Included' }),
|
@@ -208,7 +208,7 @@ describe 'PennMARC::Title' do
|
|
208
208
|
end
|
209
209
|
|
210
210
|
it 'returns the expected standardized title display values' do
|
211
|
-
values = helper.
|
211
|
+
values = helper.standardized_show(record)
|
212
212
|
expect(values).to contain_exactly(
|
213
213
|
'Another Uniform Title', 'Translated Uniform Title', 'Uniform Title 2000', 'Yet Another Uniform Title'
|
214
214
|
)
|
@@ -216,7 +216,7 @@ describe 'PennMARC::Title' do
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
-
describe '.
|
219
|
+
describe '.other_show' do
|
220
220
|
let(:record) do
|
221
221
|
marc_record fields: [
|
222
222
|
marc_field(tag: '246', subfields: { a: 'Varied Title', f: '2000', '8': 'Not Included' }),
|
@@ -227,13 +227,13 @@ describe 'PennMARC::Title' do
|
|
227
227
|
end
|
228
228
|
|
229
229
|
it 'returns the expected other title display values' do
|
230
|
-
expect(helper.
|
230
|
+
expect(helper.other_show(record)).to contain_exactly(
|
231
231
|
'Alternate Varied Title', 'Uncontrolled Title', 'Varied Title 2000'
|
232
232
|
)
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
236
|
-
describe '.
|
236
|
+
describe '.former_show' do
|
237
237
|
let(:record) do
|
238
238
|
marc_record fields: [
|
239
239
|
marc_field(tag: '247', subfields: { a: 'Former Title', n: 'Part', '6': 'Linkage', e: 'Append' }),
|
@@ -242,7 +242,7 @@ describe 'PennMARC::Title' do
|
|
242
242
|
end
|
243
243
|
|
244
244
|
it 'returns the expected former title value' do
|
245
|
-
values = helper.
|
245
|
+
values = helper.former_show(record)
|
246
246
|
expect(values).to contain_exactly 'Former Title Part Append', 'Alt Title Part'
|
247
247
|
expect(values).not_to include 'Linkage', '247'
|
248
248
|
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.10
|
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: 2023-12-
|
13
|
+
date: 2023-12-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|