Class: Cocina::Models::Mapping::Normalizers::Mods::SubjectNormalizer

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

Overview

Normalizes a Fedora MODS document for subject elements.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mods_ng_xml:) ⇒ SubjectNormalizer

Returns a new instance of SubjectNormalizer.



16
17
18
19
# File 'lib/cocina/models/mapping/normalizers/mods/subject_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/subject_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
34
35
36
# File 'lib/cocina/models/mapping/normalizers/mods/subject_normalizer.rb', line 21

def normalize
  normalize_xlink_href
  normalize_empty_geographic
  normalize_marcgac
  normalize_empty_temporal
  normalize_subject
  normalize_subject_children
  normalize_subject_authority
  normalize_subject_authority_lcnaf
  normalize_subject_authority_naf
  normalize_subject_authority_tgm
  normalize_coordinates # Must be before normalize_subject_cartographics
  normalize_subject_cartographics
  normalize_subject_lang_and_script
  ng_xml
end