Class: Cocina::Models::Mapping::FromMods::Note

Inherits:
Object
  • Object
show all
Defined in:
lib/cocina/models/mapping/from_mods/note.rb

Overview

Maps notes

Constant Summary collapse

NOTE_TYPE_TO_ABSTRACT_TYPE =

notes with these types will produce an ‘abstract` XML node

['summary', 'abstract', 'scope and content'].freeze
DISPLAY_LABEL_TO_ABSTRACT_TYPE =
['Content advice', 'Subject', 'Abstract', 'Review', 'Summary', 'Scope and content',
'Scope and Content', 'Content Advice'].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_element:) ⇒ Note

Returns a new instance of Note.



23
24
25
# File 'lib/cocina/models/mapping/from_mods/note.rb', line 23

def initialize(resource_element:)
  @resource_element = resource_element
end

Class Method Details

.build(resource_element:, description_builder: nil, purl: nil) ⇒ Hash

def self.build(resource_element:, description_builder: nil, purl: nil)

Parameters:

  • resource_element (Nokogiri::XML::Element)

    mods or relatedItem element

  • description_builder (Cocina::Models::Mapping::FromMods::DescriptionBuilder) (defaults to: nil)

    (not used, but passed in by DescriptionBuilder)

  • purl (String) (defaults to: nil)

    (not used, but passed in by DescriptionBuilder)

Returns:

  • (Hash)

    a hash that can be mapped to a cocina model



19
20
21
# File 'lib/cocina/models/mapping/from_mods/note.rb', line 19

def self.build(resource_element:, description_builder: nil, purl: nil)
  new(resource_element: resource_element).build
end

Instance Method Details

#buildObject



27
28
29
# File 'lib/cocina/models/mapping/from_mods/note.rb', line 27

def build
  abstracts + notes + table_of_contents + target_audience + parts
end