Class: Cocina::Models::Mapping::FromMods::LanguageScript
- Inherits:
-
Object
- Object
- Cocina::Models::Mapping::FromMods::LanguageScript
- Defined in:
- lib/cocina/models/mapping/from_mods/language_script.rb
Overview
Maps lang and script attributes
Class Method Summary collapse
-
.build(node:) ⇒ Hash
A hash that can be mapped to a cocina model for a valueLanguage.
Class Method Details
.build(node:) ⇒ Hash
Returns a hash that can be mapped to a cocina model for a valueLanguage.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cocina/models/mapping/from_mods/language_script.rb', line 12 def self.build(node:) return nil unless node['lang'].present? || node['script'].present? {}.tap do |value_language| if node['lang'].present? value_language[:code] = node['lang'] value_language[:source] = { code: 'iso639-2b' } end if node['script'].present? value_language[:valueScript] = { code: node['script'], source: { code: 'iso15924' } } end end end |