Class: Cocina::Models::Mapping::Normalizers::Mods::OriginInfoNormalizer

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

Overview

Normalizes a Fedora MODS document for originInfo elements. Must be called after authorityURI attribs are normalized

Constant Summary collapse

DATE_FIELDS =
%w[dateIssued copyrightDate dateCreated dateCaptured dateValid dateOther dateModified].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mods_ng_xml:) ⇒ OriginInfoNormalizer

Returns a new instance of OriginInfoNormalizer.



19
20
21
22
# File 'lib/cocina/models/mapping/normalizers/mods/origin_info_normalizer.rb', line 19

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



15
16
17
# File 'lib/cocina/models/mapping/normalizers/mods/origin_info_normalizer.rb', line 15

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

Instance Method Details

#normalizeObject



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

def normalize
  remove_empty_child_elements
  remove_empty_origin_info # must be after remove_empty_child_elements
  normalize_legacy_mods_event_type
  place_term_type_normalization
  place_term_authority_normalization # must be after place_term_type_normalization
  normalize_authority_marcountry
  single_key_date
  remove_trailing_period_from_date_values
  ng_xml
end