Class: Kiba::Extend::Transforms::Marc::ExtractNameData

Inherits:
Object
  • Object
show all
Defined in:
lib/kiba/extend/transforms/marc/extract_name_data.rb

Overview

Extract :marcid and person name data (name, role term, role code, source field tag) from fields containing structured name data

Examples:

rec = get_marc_record(index: 6)
xform = Marc::ExtractNameData.new
results = []
xform.process(rec){ |row| results << row }
expect(results.length).to eq(3)

Since:

  • 4.0.0

Instance Method Summary collapse

Constructor Details

#initializeExtractNameData

Returns a new instance of ExtractNameData.

Since:

  • 4.0.0



21
22
23
24
25
26
27
# File 'lib/kiba/extend/transforms/marc/extract_name_data.rb', line 21

def initialize
  @extractors = [
    Marc::ExtractPersonNameData.new,
    Marc::ExtractOrgNameData.new,
    Marc::ExtractMeetingNameData.new
  ]
end

Instance Method Details

#process(record) ⇒ Object

Since:

  • 4.0.0



29
30
31
32
33
34
35
36
# File 'lib/kiba/extend/transforms/marc/extract_name_data.rb', line 29

def process(record)
  rows = []
  extractors.each do |extractor|
    extractor.process(record) { |row| rows << row }
  end
  rows.each { |row| yield row }
  nil
end