From a36d42b27461a39dd50fa088a9cee2262efa5708 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Fri, 18 Sep 2026 12:29:24 +0800 Subject: [PATCH] refactor: migrate print_symbol to map-level raw: :content lutaml-model deprecates attribute-level raw: true in favor of declaring rawness on the XML mapping (raw: :content), which is where it semantically belongs. Behavior verified unchanged: parsed print_symbol values and XML round-trip output are byte-identical for the full UCUM fixture (336 entities). --- lib/unitsdb/ucum.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/unitsdb/ucum.rb b/lib/unitsdb/ucum.rb index 3c0a85c..81a08c0 100644 --- a/lib/unitsdb/ucum.rb +++ b/lib/unitsdb/ucum.rb @@ -11,7 +11,7 @@ class UcumBaseUnit < Lutaml::Model::Serializable attribute :code, :string attribute :dimension, :string attribute :name, :string - attribute :print_symbol, :string, raw: true + attribute :print_symbol, :string attribute :property, :string xml do @@ -20,7 +20,7 @@ class UcumBaseUnit < Lutaml::Model::Serializable map_attribute "CODE", to: :code map_attribute "dim", to: :dimension map_element "name", to: :name - map_element "printSymbol", to: :print_symbol + map_element "printSymbol", to: :print_symbol, raw: :content map_element "property", to: :property end @@ -53,7 +53,7 @@ class UcumPrefix < Lutaml::Model::Serializable attribute :code_sensitive, :string attribute :code, :string attribute :name, :string - attribute :print_symbol, :string, raw: true + attribute :print_symbol, :string attribute :value, UcumPrefixValue xml do @@ -61,7 +61,7 @@ class UcumPrefix < Lutaml::Model::Serializable map_attribute "Code", to: :code_sensitive map_attribute "CODE", to: :code map_element "name", to: :name - map_element "printSymbol", to: :print_symbol + map_element "printSymbol", to: :print_symbol, raw: :content map_element "value", to: :value end @@ -145,7 +145,7 @@ class UcumUnit < Lutaml::Model::Serializable attribute :is_special, :string attribute :klass, :string attribute :name, :string, collection: true - attribute :print_symbol, :string, raw: true + attribute :print_symbol, :string attribute :property, :string attribute :value, UcumUnitValue @@ -159,7 +159,7 @@ class UcumUnit < Lutaml::Model::Serializable map_attribute "class", to: :klass map_element "name", to: :name - map_element "printSymbol", to: :print_symbol + map_element "printSymbol", to: :print_symbol, raw: :content map_element "property", to: :property map_element "value", to: :value end