Class: Cocina::Models::Mapping::Normalizers::Mods::TitleNormalizer
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::Normalizers::Mods::TitleNormalizer
- Defined in:
- lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb
Overview
Normalizes a Fedora MODS document for title elements.
Class Method Summary collapse
-
.normalize(mods_ng_xml:, label:) ⇒ Nokogiri::Document
Normalized MODS.
- .normalize_missing_title(mods_ng_xml:, label:) ⇒ Object
Instance Method Summary collapse
-
#initialize(mods_ng_xml:, label:) ⇒ TitleNormalizer
constructor
A new instance of TitleNormalizer.
- #normalize ⇒ Object
- #normalize_missing_title ⇒ Object
Constructor Details
#initialize(mods_ng_xml:, label:) ⇒ TitleNormalizer
Returns a new instance of TitleNormalizer.
21 22 23 24 25 |
# File 'lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb', line 21 def initialize(mods_ng_xml:, label:) @ng_xml = mods_ng_xml.dup @ng_xml.encoding = 'UTF-8' @label = label end |
Class Method Details
.normalize(mods_ng_xml:, label:) ⇒ Nokogiri::Document
Returns normalized MODS.
13 14 15 |
# File 'lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb', line 13 def self.normalize(mods_ng_xml:, label:) new(mods_ng_xml: mods_ng_xml, label: label).normalize end |
.normalize_missing_title(mods_ng_xml:, label:) ⇒ Object
17 18 19 |
# File 'lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb', line 17 def self.normalize_missing_title(mods_ng_xml:, label:) new(mods_ng_xml: mods_ng_xml, label: label).normalize_missing_title end |
Instance Method Details
#normalize ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb', line 27 def normalize normalize_hydrus_title clean_empty_titles normalize_title_type normalize_title_trailing normalize_title_as_label ng_xml end |
#normalize_missing_title ⇒ Object
36 37 38 39 |
# File 'lib/cocina/models/mapping/normalizers/mods/title_normalizer.rb', line 36 def normalize_missing_title normalize_title_as_label ng_xml end |