Class: Cocina::Models::Mapping::ToMods::Identifier
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::ToMods::Identifier
- Defined in:
- lib/cocina/models/mapping/to_mods/identifier.rb
Overview
Maps identifiers from cocina to MODS XML
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(xml:, identifiers:, id_generator:) ⇒ Identifier
constructor
A new instance of Identifier.
- #write ⇒ Object
Constructor Details
#initialize(xml:, identifiers:, id_generator:) ⇒ Identifier
Returns a new instance of Identifier.
16 17 18 19 20 |
# File 'lib/cocina/models/mapping/to_mods/identifier.rb', line 16 def initialize(xml:, identifiers:, id_generator:) @xml = xml @identifiers = identifiers @id_generator = id_generator end |
Class Method Details
.write(xml:, identifiers:, id_generator:) ⇒ Object
12 13 14 |
# File 'lib/cocina/models/mapping/to_mods/identifier.rb', line 12 def self.write(xml:, identifiers:, id_generator:) new(xml: xml, identifiers: identifiers, id_generator: id_generator).write end |
Instance Method Details
#write ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/cocina/models/mapping/to_mods/identifier.rb', line 22 def write Array(identifiers).each do |identifier| if identifier.parallelValue.present? write_parallel(identifier) else write_identifier(identifier) end end end |