Class: Cocina::Models::Mapping::FromMods::RelatedResource

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

Overview

Maps MODS relatedItem to cocina relatedResource

Constant Summary collapse

TYPES =
Cocina::Models::Mapping::ToMods::RelatedResource::TYPES.invert.freeze
DETAIL_TYPES =
Cocina::Models::Mapping::ToMods::RelatedResource::DETAIL_TYPES.invert.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_element:, description_builder:, purl:) ⇒ RelatedResource

Returns a new instance of RelatedResource.



20
21
22
23
24
25
# File 'lib/cocina/models/mapping/from_mods/related_resource.rb', line 20

def initialize(resource_element:, description_builder:, purl:)
  @resource_element = resource_element
  @description_builder = description_builder
  @notifier = description_builder.notifier
  @purl = purl
end

Class Method Details

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

Returns a hash that can be mapped to a cocina model.

Parameters:

Returns:

  • (Hash)

    a hash that can be mapped to a cocina model



16
17
18
# File 'lib/cocina/models/mapping/from_mods/related_resource.rb', line 16

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

Instance Method Details

#buildObject



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

def build
  related_items + related_purls
end