Class: Cocina::Models::Mapping::FromMods::Identifier
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::Identifier
- Defined in:
- lib/cocina/models/mapping/from_mods/identifier.rb
Overview
Maps MODS identifer to cocina identifier
Class Method Summary collapse
-
.build(resource_element:, description_builder: nil, purl: nil) ⇒ Hash
A hash that can be mapped to a cocina model.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(resource_element:) ⇒ Identifier
constructor
A new instance of Identifier.
Constructor Details
#initialize(resource_element:) ⇒ Identifier
Returns a new instance of Identifier.
17 18 19 |
# File 'lib/cocina/models/mapping/from_mods/identifier.rb', line 17 def initialize(resource_element:) @resource_element = resource_element end |
Class Method Details
.build(resource_element:, description_builder: nil, purl: nil) ⇒ Hash
Returns a hash that can be mapped to a cocina model.
13 14 15 |
# File 'lib/cocina/models/mapping/from_mods/identifier.rb', line 13 def self.build(resource_element:, description_builder: nil, purl: nil) new(resource_element: resource_element).build end |
Instance Method Details
#build ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/cocina/models/mapping/from_mods/identifier.rb', line 21 def build altrepgroup_identifier_nodes, other_identifier_nodes = AltRepGroup.split(nodes: identifiers) altrepgroup_identifier_nodes.map { |id_nodes| build_parallel(id_nodes) } + other_identifier_nodes.map do |id_node| IdentifierBuilder.build_from_identifier(identifier_element: id_node) end end |