Class: Kiba::Extend::Transforms::Marc::ExtractOrgNameData

Inherits:
ExtractBaseNameData show all
Defined in:
lib/kiba/extend/transforms/marc/extract_org_name_data.rb

Overview

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

Examples:

# =001  008000411-3
# =110  2\$aH.M. Gousha Company.
rec = get_marc_record(index: 3)
xform = Marc::ExtractOrgNameData.new
results = []
xform.process(rec){ |row| results << row }
row = {:sourcefield=>"110", :name=>"H.M. Gousha Company",
      :nametype=>"org", :role_code=>"", :role_term=>"",
      :marcid=>"008000411-3"}
expect(results.length).to eq(1)
expect(results.first).to eq(row)

Since:

  • 4.0.0

Instance Method Summary collapse

Methods inherited from ExtractBaseNameData

#process

Methods included from FieldLinkable

#select_fields

Constructor Details

#initialize(name_type: "org", name_fields: Kiba::Extend::Marc.org_data_tags, name_subfields: Kiba::Extend::Marc.org_name_part_subfields, role_code_subfields: Kiba::Extend::Marc.org_role_code_subfields, role_term_subfields: Kiba::Extend::Marc.org_role_term_subfields) ⇒ ExtractOrgNameData

Returns a new instance of ExtractOrgNameData.

Parameters:

  • name_type (String) (defaults to: "org")

    to insert into name_type_target field

  • name_fields (Array<String>) (defaults to: Kiba::Extend::Marc.org_data_tags)

    MARC fields from which name data will be extracted

  • name_subfields (Array<String>) (defaults to: Kiba::Extend::Marc.org_name_part_subfields)

    subfields to extract as part of name value.

  • role_code_subfields (Array<String>) (defaults to: Kiba::Extend::Marc.org_role_code_subfields)

    subfields to extract as role code value

  • role_term_subfields (Array<String>) (defaults to: Kiba::Extend::Marc.org_role_term_subfields)

    subfields to extract as role term value

Since:

  • 4.0.0



36
37
38
39
40
41
42
43
44
45
# File 'lib/kiba/extend/transforms/marc/extract_org_name_data.rb', line 36

def initialize(name_type: "org",
  name_fields: Kiba::Extend::Marc.org_data_tags,
  name_subfields:
  Kiba::Extend::Marc.org_name_part_subfields,
  role_code_subfields:
  Kiba::Extend::Marc.org_role_code_subfields,
  role_term_subfields:
  Kiba::Extend::Marc.org_role_term_subfields)
  super
end