Class: Cocina::Models::Mapping::FromMods::AdminMetadata

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

Overview

Maps MODS recordInfo to cocina

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_element:, description_builder:) ⇒ AdminMetadata

Returns a new instance of AdminMetadata.



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

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

Class Method Details

.build(resource_element:, description_builder:, purl: nil) ⇒ 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



13
14
15
# File 'lib/cocina/models/mapping/from_mods/admin_metadata.rb', line 13

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

Instance Method Details

#buildObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cocina/models/mapping/from_mods/admin_metadata.rb', line 23

def build
  return nil if record_info.nil?

  {}.tap do ||
    [:language] = build_language
    [:contributor] = build_contributor
    [:metadataStandard] = build_standard
    [:note] = build_note
    [:identifier] = build_identifier
    [:event] = build_events
  end.compact
end