lib/cocina/models/mapping/to_mods/form.rb in cocina-models-0.91.0 vs lib/cocina/models/mapping/to_mods/form.rb in cocina-models-0.91.1
- old
+ new
@@ -7,18 +7,18 @@
# Maps forms from cocina to MODS XML
class Form # rubocop:disable Metrics/ClassLength
# NOTE: H2 is the first case of structured form values we're implementing
H2_SOURCE_LABEL = 'Stanford self-deposit resource types'
PHYSICAL_DESCRIPTION_TAG = {
- 'reformatting quality' => :reformattingQuality,
- 'form' => :form,
- 'media type' => :internetMediaType,
- 'extent' => :extent,
- 'digital origin' => :digitalOrigin,
- 'media' => :form,
'carrier' => :form,
+ 'digital origin' => :digitalOrigin,
+ 'extent' => :extent,
+ 'form' => :form,
'material' => :form,
+ 'media' => :form,
+ 'media type' => :internetMediaType,
+ 'reformatting quality' => :reformattingQuality,
'technique' => :form
}.freeze
# @params [Nokogiri::XML::Builder] xml
# @params [Array<Cocina::Models::DescriptiveValue>] forms
@@ -181,13 +181,10 @@
form_values.each do |form_value|
form_type = form_value.type || form&.type
attributes = {
unit: unit_for(form_value)
}.tap do |attrs|
- if PHYSICAL_DESCRIPTION_TAG.fetch(form_type) == :form && form_type != 'form'
- attrs[:type] =
- form_type
- end
+ attrs[:type] = form_type if PHYSICAL_DESCRIPTION_TAG.fetch(form_type) == :form && form_type != 'form'
end.compact
xml.public_send PHYSICAL_DESCRIPTION_TAG.fetch(form_type), form_value.value,
attributes.merge(uri_attrs(form_value)).merge(uri_attrs(form))
end