Class: Cocina::Models::Mapping::FromMods::NameBuilder
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::NameBuilder
- Defined in:
- lib/cocina/models/mapping/from_mods/name_builder.rb
Overview
Maps a name
Constant Summary collapse
- UNCITED_DESCRIPTION =
Cocina::Models::Mapping::ToMods::NameWriter::UNCITED_DESCRIPTION
- TYPE_FOR_ROLES =
Cocina::Models::Mapping::FromMods::Contributor::ROLES.merge('event' => 'event').freeze
Class Method Summary collapse
-
.build(name_elements:, notifier:) ⇒ Hash
A hash that can be mapped to a cocina model.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(name_elements:, notifier:) ⇒ NameBuilder
constructor
A new instance of NameBuilder.
Constructor Details
#initialize(name_elements:, notifier:) ⇒ NameBuilder
Returns a new instance of NameBuilder.
20 21 22 23 |
# File 'lib/cocina/models/mapping/from_mods/name_builder.rb', line 20 def initialize(name_elements:, notifier:) @name_elements = name_elements @notifier = notifier end |
Class Method Details
.build(name_elements:, notifier:) ⇒ Hash
Returns a hash that can be mapped to a cocina model.
16 17 18 |
# File 'lib/cocina/models/mapping/from_mods/name_builder.rb', line 16 def self.build(name_elements:, notifier:) new(name_elements: name_elements, notifier: notifier).build end |
Instance Method Details
#build ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/cocina/models/mapping/from_mods/name_builder.rb', line 25 def build if name_elements.size == 1 build_name(name_elements.first) else build_parallel end end |