Class: PennMARC::Note
Overview
Extracts notes from 5xx fields (mostly).
Constant Summary
Constants included from Util
Util::TRAILING_PUNCTUATIONS_PATTERNS
Class Method Summary collapse
-
.access_restriction_show(record) ⇒ Array<String>
Retrieve access restricted notes for display from field 506.
-
.arrangement_show(record) ⇒ Array<String>
Retrieve arrangement values for display from field field 351.
-
.biography_show(record) ⇒ Array<String>
Retrieve biography notes for display from field 545 and its linked alternate.
-
.bound_with_show(record) ⇒ Array<String>
Retrieve “With” notes for display from field 501.
-
.contents_values(record, with_alternate: true) ⇒ Array<String>
Retrieve contents notes for display from fields 505 and, if include_vernacular param is true, its linked alternate.
-
.credits_show(record) ⇒ Array<String>
Retrieve credits notes for display from field 508 and its linked alternate.
-
.finding_aid_show(record) ⇒ Array<String>
Retrieve finding aid notes for display from field 555 and its linked alternate.
- .local_notes_show(record) ⇒ Array<String>
- .notes_show(record) ⇒ Array<String>
-
.participant_show(record) ⇒ Array<String>
Retrieve participant notes for display from field 511 and its linked alternate.
- .provenance_show(record) ⇒ Array<String>
-
.summary_show(record) ⇒ Array<String>
Retrieve summary notes for display from field 520 and its linked alternate.
- .system_details_show(record) ⇒ Array<String>
Methods included from Util
#append_relator, #append_trailing, #datafield_and_linked_alternate, #field_defined?, #field_or_its_linked_alternate?, #join_and_squish, #join_subfields, #linked_alternate, #linked_alternate_not_6_or_8, #no_subfield_value_matches?, #prefixed_subject_and_alternate, #relator, #relator_join_separator, #relator_term_subfield, #remove_paren_value_from_subfield_i, #subfield_defined?, #subfield_in?, #subfield_not_in?, #subfield_undefined?, #subfield_value?, #subfield_value_in?, #subfield_value_not_in?, #subfield_values, #subfield_values_for, #substring_after, #substring_before, #translate_relator, #trim_punctuation, #trim_trailing, #trim_trailing!, #valid_subject_genre_source_code?
Class Method Details
.access_restriction_show(record) ⇒ Array<String>
Retrieve access restricted notes for display from field 506.
91 92 93 94 95 |
# File 'lib/pennmarc/helpers/note.rb', line 91 def access_restriction_show(record) record.fields('506').filter_map { |field| join_subfields(field, &subfield_not_in?(%w[2 5 6])) }.uniq end |
.arrangement_show(record) ⇒ Array<String>
Retrieve arrangement values for display from field field 351.
140 141 142 |
# File 'lib/pennmarc/helpers/note.rb', line 140 def arrangement_show(record) datafield_and_linked_alternate(record, '351') end |
.biography_show(record) ⇒ Array<String>
Retrieve biography notes for display from field 545 and its linked alternate.
125 126 127 |
# File 'lib/pennmarc/helpers/note.rb', line 125 def biography_show(record) datafield_and_linked_alternate(record, '545') end |
.bound_with_show(record) ⇒ Array<String>
Retrieve “With” notes for display from field 501
177 178 179 |
# File 'lib/pennmarc/helpers/note.rb', line 177 def bound_with_show(record) record.fields('501').filter_map { |field| join_subfields(field, &subfield_in?(['a'])).presence }.uniq end |
.contents_values(record, with_alternate: true) ⇒ Array<String>
Retrieve contents notes for display from fields 505 and, if include_vernacular param is true, its linked alternate. Used for display and searching.
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/pennmarc/helpers/note.rb', line 76 def contents_values(record, with_alternate: true) record.fields(%w[505 880]).filter_map { |field| if field.tag == '880' next unless with_alternate next if no_subfield_value_matches?(field, '6', /^505/) end join_subfields(field, &subfield_not_in?(%w[6 8])).split('--') }.flatten.uniq end |
.credits_show(record) ⇒ Array<String>
Retrieve credits notes for display from field 508 and its linked alternate.
117 118 119 |
# File 'lib/pennmarc/helpers/note.rb', line 117 def credits_show(record) datafield_and_linked_alternate(record, '508') end |
.finding_aid_show(record) ⇒ Array<String>
Retrieve finding aid notes for display from field 555 and its linked alternate.
101 102 103 |
# File 'lib/pennmarc/helpers/note.rb', line 101 def finding_aid_show(record) datafield_and_linked_alternate(record, '555') end |
.local_notes_show(record) ⇒ Array<String>
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pennmarc/helpers/note.rb', line 32 def local_notes_show(record) local_notes = record.fields('561').filter_map do |field| next unless subfield_value?(field, 'a', /^Athenaeum copy: /) join_subfields(field, &subfield_in?(%w[a])) end additional_fields = %w[562 563 585 590] notes = local_notes + record.fields(additional_fields + ['880']).filter_map do |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^(#{additional_fields.join('|')})/) join_subfields(field, &subfield_not_in?(%w[5 6 8])) end notes.uniq end |
.notes_show(record) ⇒ Array<String>
17 18 19 20 21 22 23 24 |
# File 'lib/pennmarc/helpers/note.rb', line 17 def notes_show(record) notes_fields = %w[500 502 504 515 518 525 533 540 550 580 586 588] record.fields(notes_fields + ['880']).filter_map { |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^(#{notes_fields.join('|')})/) join_subfields(field, &subfield_not_in?(%w[5 6 8])) }.uniq end |
.participant_show(record) ⇒ Array<String>
Retrieve participant notes for display from field 511 and its linked alternate.
109 110 111 |
# File 'lib/pennmarc/helpers/note.rb', line 109 def participant_show(record) datafield_and_linked_alternate(record, '511') end |
.provenance_show(record) ⇒ Array<String>
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/pennmarc/helpers/note.rb', line 55 def provenance_show(record) provenance_notes = record.fields(%w[561 880]).filter_map do |field| next unless field.indicator1.in?(['1', '', ' ']) next unless field.indicator2.in?([' ', '']) next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^561/) next if subfield_value?(field, 'a', /^Athenaeum copy: /) join_subfields(field, &subfield_in?(%w[a])) end notes = provenance_notes + prefixed_subject_and_alternate(record, 'PRO') notes.uniq end |
.summary_show(record) ⇒ Array<String>
Retrieve summary notes for display from field 520 and its linked alternate.
133 134 135 |
# File 'lib/pennmarc/helpers/note.rb', line 133 def summary_show(record) datafield_and_linked_alternate(record, '520') end |
.system_details_show(record) ⇒ Array<String>
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/pennmarc/helpers/note.rb', line 150 def system_details_show(record) system_details_notes = record.fields(%w[538 880]).filter_map do |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^538/) sub3_and_other_subs(field, &subfield_in?(%w[a i u])) end system_details_notes += record.fields(%w[344 880]).filter_map do |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^344/) sub3_and_other_subs(field, &subfield_in?(%w[a b c d e f g h])) end system_details_notes += record.fields(%w[345 346 880]).filter_map do |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^(345|346)/) sub3_and_other_subs(field, &subfield_in?(%w[a b])) end system_details_notes += record.fields(%w[347 880]).filter_map do |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^347/) sub3_and_other_subs(field, &subfield_in?(%w[a b c d e f])) end system_details_notes.uniq end |