Class: PennMARC::Access
Overview
Methods for extracting how a record can be accessed
Constant Summary collapse
- ONLINE =
'Online'
- AT_THE_LIBRARY =
'At the library'
- RESOURCE_LINK_BASE_URL =
'hdl.library.upenn.edu'
Constants included from Util
Util::TRAILING_PUNCTUATIONS_PATTERNS
Class Method Summary collapse
-
.facet(record) ⇒ Array
Based on enhanced metadata fields added by Alma publishing process or API, determine if the record has electronic access or has physical holdings, and is therefore “Online” or “At the library”.
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
.facet(record) ⇒ Array
Based on enhanced metadata fields added by Alma publishing process or API, determine if the record has electronic access or has physical holdings, and is therefore “Online” or “At the library”. If a record is “At the library”, but has a link to a finding aid in the 856 field (matching certain criteria), also add ‘Online’ as an access method.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pennmarc/helpers/access.rb', line 17 def facet(record) values = record.filter_map do |field| next AT_THE_LIBRARY if physical_holding_tag?(field) next ONLINE if electronic_holding_tag?(field) end return values if values.size == 2 # return early if all values are already present # only check if ONLINE isn't already there values << ONLINE if values.exclude?(ONLINE) && resource_link?(record) values.uniq end |