Class: Cocina::Models::Mapping::ToMods::Note
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::ToMods::Note
- Defined in:
- lib/cocina/models/mapping/to_mods/note.rb
Overview
Maps notes from cocina to MODS XML
Class Method Summary collapse
-
.display_label_to_abstract_type ⇒ Object
notes with a displayLabel set to any of these values will produce an ‘abstract` XML node.
-
.note_type_to_abstract_type ⇒ Object
notes with these types will produce an ‘abstract` XML node.
- .write(xml:, notes:, id_generator:) ⇒ Object
Instance Method Summary collapse
-
#initialize(xml:, notes:, id_generator:) ⇒ Note
constructor
A new instance of Note.
- #write ⇒ Object
Constructor Details
#initialize(xml:, notes:, id_generator:) ⇒ Note
Returns a new instance of Note.
27 28 29 30 31 |
# File 'lib/cocina/models/mapping/to_mods/note.rb', line 27 def initialize(xml:, notes:, id_generator:) @xml = xml @notes = notes @id_generator = id_generator end |
Class Method Details
.display_label_to_abstract_type ⇒ Object
notes with a displayLabel set to any of these values will produce an ‘abstract` XML node
17 18 19 20 |
# File 'lib/cocina/models/mapping/to_mods/note.rb', line 17 def self.display_label_to_abstract_type ['Content advice', 'Subject', 'Abstract', 'Review', 'Summary', 'Scope and content', 'Scope and Content', 'Content Advice'] end |
.note_type_to_abstract_type ⇒ Object
notes with these types will produce an ‘abstract` XML node
23 24 25 |
# File 'lib/cocina/models/mapping/to_mods/note.rb', line 23 def self.note_type_to_abstract_type ['summary', 'abstract', 'scope and content'] end |
.write(xml:, notes:, id_generator:) ⇒ Object
12 13 14 |
# File 'lib/cocina/models/mapping/to_mods/note.rb', line 12 def self.write(xml:, notes:, id_generator:) new(xml: xml, notes: notes, id_generator: id_generator).write end |
Instance Method Details
#write ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cocina/models/mapping/to_mods/note.rb', line 33 def write Array(notes).each do |note| if note.type == 'part' PartWriter.write(xml: xml, part_note: note) elsif note.parallelValue.present? write_parallel(note) else write_basic(note) end end end |