Class: Cocina::Models::Mapping::ToMods::Event
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::ToMods::Event
- Defined in:
- lib/cocina/models/mapping/to_mods/event.rb
Overview
Maps events from cocina to MODS XML
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(xml:, events:, id_generator:) ⇒ Event
constructor
A new instance of Event.
- #write ⇒ Object
Constructor Details
#initialize(xml:, events:, id_generator:) ⇒ Event
Returns a new instance of Event.
16 17 18 19 20 |
# File 'lib/cocina/models/mapping/to_mods/event.rb', line 16 def initialize(xml:, events:, id_generator:) @xml = xml @events = events @id_generator = id_generator end |
Class Method Details
.write(xml:, events:, id_generator:) ⇒ Object
12 13 14 |
# File 'lib/cocina/models/mapping/to_mods/event.rb', line 12 def self.write(xml:, events:, id_generator:) new(xml: xml, events: events, 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/event.rb', line 22 def write Array(events).each do |event| if event.parallelEvent.present? write_parallel(event, id_generator.next_altrepgroup) else write_basic(event, event.type) end end end |