Class: Cocina::Models::Mapping::Normalizers::Mods::NameNormalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/mapping/normalizers/mods/name_normalizer.rb

Overview

Normalizes a Fedora MODS document for name elements.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mods_ng_xml:) ⇒ NameNormalizer

Returns a new instance of NameNormalizer.



16
17
18
19
# File 'lib/cocina/models/mapping/normalizers/mods/name_normalizer.rb', line 16

def initialize(mods_ng_xml:)
  @ng_xml = mods_ng_xml.dup
  @ng_xml.encoding = 'UTF-8'
end

Class Method Details

.normalize(mods_ng_xml:) ⇒ Nokogiri::Document

Returns normalized MODS.

Parameters:

  • mods_ng_xml (Nokogiri::Document)

    MODS to be normalized

Returns:

  • (Nokogiri::Document)

    normalized MODS



12
13
14
# File 'lib/cocina/models/mapping/normalizers/mods/name_normalizer.rb', line 12

def self.normalize(mods_ng_xml:)
  new(mods_ng_xml: mods_ng_xml).normalize
end

Instance Method Details

#normalizeObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cocina/models/mapping/normalizers/mods/name_normalizer.rb', line 21

def normalize
  normalize_parallel_name_role
  normalize_parallel_affiliation_note
  normalize_text_role_term
  normalize_role_term
  normalize_role # must be after normalize_role_term
  normalize_name
  normalize_corporate_needing_primary
  normalize_dupes
  normalize_type
  normalize_name_part_type
  ng_xml
end