Class: Cocina::Models::Mapping::ToMods::Description
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::ToMods::Description
- 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
-
#initialize(description, druid) ⇒ Description
constructor
A new instance of Description.
- #transform ⇒ Nokogiri::XML::Document
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
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
#transform ⇒ 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 |