Class: Cocina::Models::Mapping::ToMods::Description

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

Overview

This transforms the DRO.description schema to MODS xml

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description, druid) ⇒ Description

Returns a new instance of Description.



18
19
20
21
# File 'lib/cocina/models/mapping/to_mods/description.rb', line 18

def initialize(description, druid)
  @description = description
  @druid = druid
end

Class Method Details

.transform(description, druid) ⇒ Nokogiri::XML::Document

Parameters:

Returns:

  • (Nokogiri::XML::Document)


14
15
16
# File 'lib/cocina/models/mapping/to_mods/description.rb', line 14

def self.transform(description, druid)
  new(description, druid).transform
end

Instance Method Details

#transformNokogiri::XML::Document

Returns:

  • (Nokogiri::XML::Document)


24
25
26
27
28
29
30
# File 'lib/cocina/models/mapping/to_mods/description.rb', line 24

def transform
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
    xml.mods(mods_attributes) do
      ModsWriter.write(xml: xml, description: description, druid: druid)
    end
  end.doc
end