Class: Cocina::Models::Mapping::ToMods::PartWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/mapping/to_mods/part_writer.rb

Overview

Maps parts from cocina to MODS XML

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml:, part_note:) ⇒ PartWriter

Returns a new instance of PartWriter.



16
17
18
19
# File 'lib/cocina/models/mapping/to_mods/part_writer.rb', line 16

def initialize(xml:, part_note:)
  @xml = xml
  @note = part_note
end

Class Method Details

.write(xml:, part_note:) ⇒ Object



12
13
14
# File 'lib/cocina/models/mapping/to_mods/part_writer.rb', line 12

def self.write(xml:, part_note:)
  new(xml: xml, part_note: part_note).write
end

Instance Method Details

#writeObject



21
22
23
24
25
26
27
# File 'lib/cocina/models/mapping/to_mods/part_writer.rb', line 21

def write
  if note.groupedValue.present?
    write_grouped_value
  else
    write_structured_value
  end
end