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_show(record) ⇒ Array<String>
Retrieve contents notes for display from fields 505 and 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_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_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.
86 87 88 89 90 |
# File 'lib/pennmarc/helpers/note.rb', line 86 def access_restriction_show(record) record.fields('506').filter_map { |field| join_subfields(field, &subfield_not_in?(%w[5 6])) }.uniq end |
.arrangement_show(record) ⇒ Array<String>
Retrieve arrangement values for display from field field 351.
135 136 137 |
# File 'lib/pennmarc/helpers/note.rb', line 135 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.
120 121 122 |
# File 'lib/pennmarc/helpers/note.rb', line 120 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
172 173 174 |
# File 'lib/pennmarc/helpers/note.rb', line 172 def bound_with_show(record) record.fields('501').filter_map { |field| join_subfields(field, &subfield_in?(['a'])).presence }.uniq end |
.contents_show(record) ⇒ Array<String>
Retrieve contents notes for display from fields 505 and its linked alternate.
75 76 77 78 79 80 81 |
# File 'lib/pennmarc/helpers/note.rb', line 75 def contents_show(record) record.fields(%w[505 880]).filter_map { |field| next if field.tag == '880' && no_subfield_value_matches?(field, '6', /^505/) 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.
112 113 114 |
# File 'lib/pennmarc/helpers/note.rb', line 112 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.
96 97 98 |
# File 'lib/pennmarc/helpers/note.rb', line 96 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.
104 105 106 |
# File 'lib/pennmarc/helpers/note.rb', line 104 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.
128 129 130 |
# File 'lib/pennmarc/helpers/note.rb', line 128 def summary_show(record) datafield_and_linked_alternate(record, '520') end |
.system_details_show(record) ⇒ Array<String>
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/pennmarc/helpers/note.rb', line 145 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 |