Module: Kiba::Extend::Transforms::Marc::FieldLinkable

Included in:
ExtractBaseNameData, ExtractSubfieldsFromField
Defined in:
lib/kiba/extend/transforms/marc/field_linkable.rb

Overview

Mix-in module providing methods for dealing with identifying and extracting data from linked transliterated and vernacular (e.g. 880) fields in MARC data

Since:

  • 3.3.0

Instance Method Summary collapse

Instance Method Details

#select_fields(record, tags) ⇒ Array<MARC::ControlField,MARC::DataField>

Parameters:

  • record (MARC::Record)
  • tags (Array<String>)

Returns:

  • (Array<MARC::ControlField,MARC::DataField>)

Since:

  • 3.3.0



16
17
18
19
20
21
22
# File 'lib/kiba/extend/transforms/marc/field_linkable.rb', line 16

def select_fields(record, tags)
  all = candidate_fields(record, tags)
    .map { |field| add_linkage_data(field) }
  preferred(all)
    .map { |fldhsh| update_tag(fldhsh) }
    .map { |fldhsh| fldhsh[:datafield] }
end