lib/termium/language_module.rb in termium-0.1.4 vs lib/termium/language_module.rb in termium-0.3.1
- old
+ new
@@ -3,12 +3,12 @@
require_relative "entry_term"
require_relative "textual_support"
module Termium
# For <languageModule>
- class LanguageModule < Shale::Mapper
- attribute :language, Shale::Type::String
+ class LanguageModule < Lutaml::Model::Serializable
+ attribute :language, :string
attribute :entry_term, EntryTerm, collection: true
attribute :textual_support, TextualSupport, collection: true
xml do
root "languageModule"
map_attribute "language", to: :language
@@ -40,11 +40,11 @@
entry_term.map(&:abbreviation).flatten
end
LANGUAGE_CODE_MAPPING = {
"en" => "eng",
- "fr" => "fre"
+ "fr" => "fre",
}.freeze
def designations
# NOTE: entry_term is a collection
entry_term + abbreviations
@@ -57,10 +57,10 @@
src = {
"language_code" => LANGUAGE_CODE_MAPPING[language.downcase],
"terms" => designations.map(&:to_h),
"definition" => [{ content: definition }],
"notes" => notes,
- "examples" => examples
+ "examples" => examples,
}
src["domain"] = domain if domain
src