Sha256: fb62ddec1b65ffa61639ab4fb23a862e821166615068fcf6af7b2aa770047816
Contents?: true
Size: 1 KB
Versions: 40
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Cocina module Models module Mapping module FromMods # Maps lang and script attributes class LanguageScript # @param [Nokogiri::XML::Element] element that may have lang or script attributes # @param [Cocina::Models::Mapping::FromMods::DescriptionBuilder] description_builder # @return [Hash] a hash that can be mapped to a cocina model for a valueLanguage 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 end end end end end
Version data entries
40 entries across 40 versions & 1 rubygems