lutaml-model 0.8.140 → 0.8.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4858164d1b2f6a8a2ef3cf919d7689869e23473c99c12bbf2749985774e981de
|
|
4
|
+
data.tar.gz: acf6cd6e673b31e3ae9a784f6d28ffd24b1b16c4d7a3b535513b1c34d0b5fc93
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 64af40ac45da4c06d2a01ffdcfd90a9cff03c9ceafb11284f407d662770c2d30264021e6a9d8cd1524ad26c392bbc441d79a100996f4f5bce6f05f3159d36a05
|
|
7
|
+
data.tar.gz: ee6e1412255b334bba7507ac54d9b94d98ed64bcf5750b1b0b65cc9dc3eba0c8ff89204a6bf1d1ae289166d136d979e09f2ef231e1c51485c64a2a1fe545eb54
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -511,11 +511,9 @@ module Lutaml
|
|
|
511
511
|
end
|
|
512
512
|
|
|
513
513
|
# #1031: wildcard attribute families. After the explicit attribute
|
|
514
|
-
# rules have consumed their names, every remaining
|
|
515
|
-
# matching the rule's pattern lands in the target Hash —
|
|
516
|
-
# claimed by explicit rules never leak into it.
|
|
517
|
-
# as written, prefix included: keyed by its local name, xlink:href
|
|
518
|
-
# would serialize back as a plain href attribute.
|
|
514
|
+
# rules have consumed their names, every remaining unprefixed
|
|
515
|
+
# attribute matching the rule's pattern lands in the target Hash —
|
|
516
|
+
# names claimed by explicit rules never leak into it.
|
|
519
517
|
def apply_all_attributes_deserialization(doc, instance, xml_mapping)
|
|
520
518
|
rule = xml_mapping.all_attributes_rule
|
|
521
519
|
return if rule.nil?
|
|
@@ -526,9 +524,8 @@ module Lutaml
|
|
|
526
524
|
claimed = attribute_names_claimed_by_rules(xml_mapping)
|
|
527
525
|
remainder = {}
|
|
528
526
|
element.attributes.each_value do |attr|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
name = attr.name.to_s
|
|
527
|
+
name = attr.unprefixed_name.to_s
|
|
528
|
+
next if claimed.include?(name)
|
|
532
529
|
next if rule.matching && !rule.matching.match?(name)
|
|
533
530
|
|
|
534
531
|
remainder[name] = attr.value
|
|
@@ -87,28 +87,6 @@ RSpec.describe "map_all_attributes" do
|
|
|
87
87
|
expect(model.other_attributes).to eq("zeta" => "1")
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
it "keeps a prefixed attribute's prefix through a round-trip" do
|
|
91
|
-
xml = '<mn xmlns:xlink="http://www.w3.org/1999/xlink" name="x" ' \
|
|
92
|
-
'data-title="T" xlink:href="#t"/>'
|
|
93
|
-
klass = Class.new(Lutaml::Model::Serializable) do
|
|
94
|
-
attribute :name, :string
|
|
95
|
-
attribute :other_attributes, :hash
|
|
96
|
-
|
|
97
|
-
xml do
|
|
98
|
-
element "mn"
|
|
99
|
-
map_attribute "name", to: :name
|
|
100
|
-
map_all_attributes to: :other_attributes
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
stub_const("MapAllPrefixedModel", klass)
|
|
104
|
-
|
|
105
|
-
model = klass.from_xml(xml)
|
|
106
|
-
|
|
107
|
-
expect(model.other_attributes).to eq("data-title" => "T", "xlink:href" => "#t")
|
|
108
|
-
expect(model.to_xml).to include('xlink:href="#t"')
|
|
109
|
-
expect(model.to_xml).not_to include(' href="#t"')
|
|
110
|
-
end
|
|
111
|
-
|
|
112
90
|
it "is inherited by a subclass along with the other mappings" do
|
|
113
91
|
stub_const("MapAllAttributesChild", Class.new(stubbed))
|
|
114
92
|
|