Class: Cocina::Models::Mapping::FromMods::Description
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::Description
- Defined in:
- lib/cocina/models/mapping/from_mods/description.rb
Overview
Creates Cocina Description objects from MODS xml
Constant Summary collapse
- DESC_METADATA_NS =
'http://www.loc.gov/mods/v3'- XLINK_NS =
'http://www.w3.org/1999/xlink'
Class Method Summary collapse
-
.props(mods:, druid:, title_builder: Title, notifier: nil) ⇒ Hash
A hash that can be mapped to a cocina descriptive model.
Instance Method Summary collapse
-
#initialize(title_builder:, mods:, druid:, notifier:) ⇒ Description
constructor
A new instance of Description.
-
#props ⇒ Hash
A hash that can be mapped to a cocina descriptive model.
Constructor Details
#initialize(title_builder:, mods:, druid:, notifier:) ⇒ Description
Returns a new instance of Description.
21 22 23 24 25 26 |
# File 'lib/cocina/models/mapping/from_mods/description.rb', line 21 def initialize(title_builder:, mods:, druid:, notifier:) @title_builder = title_builder @ng_xml = mods @notifier = notifier || ErrorNotifier.new(druid: druid) @druid = druid end |
Class Method Details
.props(mods:, druid:, title_builder: Title, notifier: nil) ⇒ Hash
Returns a hash that can be mapped to a cocina descriptive model.
17 18 19 |
# File 'lib/cocina/models/mapping/from_mods/description.rb', line 17 def self.props(mods:, druid:, title_builder: Title, notifier: nil) new(title_builder: title_builder, mods: mods, druid: druid, notifier: notifier).props end |
Instance Method Details
#props ⇒ Hash
Returns a hash that can be mapped to a cocina descriptive model.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cocina/models/mapping/from_mods/description.rb', line 30 def props return nil if ng_xml.root.nil? check_altrepgroups check_version DescriptionBuilder.build(title_builder: title_builder, resource_element: ng_xml.root, notifier: notifier, purl: druid ? Cocina::Models::Mapping::Purl.for(druid: druid) : nil) end |