lutaml-model 0.6.6 → 0.6.7
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 +4 -4
- data/.github/workflows/dependent-repos.json +2 -1
- data/lib/lutaml/model/serialize.rb +2 -1
- data/lib/lutaml/model/version.rb +1 -1
- data/spec/lutaml/model/cdata_spec.rb +6 -6
- data/spec/lutaml/model/collection_spec.rb +2 -2
- data/spec/lutaml/model/custom_model_spec.rb +3 -3
- data/spec/lutaml/model/custom_serialization_spec.rb +6 -6
- data/spec/lutaml/model/multiple_mapping_spec.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da09d917512e0b5f82b847627920cb874b9bf4506ef568d95b45dd26aefef054
|
4
|
+
data.tar.gz: c31a188213089b94d752ba6e679ba8ac80f33c9f8e4f36f5bffddebf949b4a10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3f701841e4ac8d6b76f1afb7cccf1e2476200e9842ab1c5f3c664b4ec064f79831886963b0b7436ea16a8944158d7d50abe7a1e29b786e08486ad0fb2a0e10
|
7
|
+
data.tar.gz: c2c4ddb8166ccde0274acc9f38ba36a2058de7b3fc61c88ab82cc8f29cbc046d43e6844da874367720d59b4c35553a9cb5adccbfd17429a1be52a8f623f96992
|
@@ -563,7 +563,8 @@ module Lutaml
|
|
563
563
|
end
|
564
564
|
|
565
565
|
if rule.using_custom_methods? || attr.type == Lutaml::Model::Type::Hash
|
566
|
-
|
566
|
+
return_child = attr.type == Lutaml::Model::Type::Hash || !attr.collection? if attr
|
567
|
+
return return_child ? children.first : children
|
567
568
|
end
|
568
569
|
|
569
570
|
if Utils.present?(children)
|
data/lib/lutaml/model/version.rb
CHANGED
@@ -43,8 +43,8 @@ module CDATA
|
|
43
43
|
map_element "address", to: :address
|
44
44
|
end
|
45
45
|
|
46
|
-
def house_from_xml(model,
|
47
|
-
model.house =
|
46
|
+
def house_from_xml(model, nodes)
|
47
|
+
model.house = nodes.first.children.first.text
|
48
48
|
end
|
49
49
|
|
50
50
|
def house_to_xml(model, _parent, doc)
|
@@ -53,8 +53,8 @@ module CDATA
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def city_from_xml(model,
|
57
|
-
model.city =
|
56
|
+
def city_from_xml(model, nodes)
|
57
|
+
model.city = nodes.first.children.first.text
|
58
58
|
end
|
59
59
|
|
60
60
|
def city_to_xml(model, _parent, doc)
|
@@ -117,8 +117,8 @@ module CDATA
|
|
117
117
|
|
118
118
|
def child_from_xml(model, value)
|
119
119
|
model.child_mapper ||= CustomModelChild.new
|
120
|
-
model.child_mapper.street = value.find_child_by_name("street").text
|
121
|
-
model.child_mapper.city = value.find_child_by_name("city").text
|
120
|
+
model.child_mapper.street = value.first.find_child_by_name("street").text
|
121
|
+
model.child_mapper.city = value.first.find_child_by_name("city").text
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -95,10 +95,10 @@ class CustomModelParentMapper < Lutaml::Model::Serializable
|
|
95
95
|
doc.add_element(parent, child_el)
|
96
96
|
end
|
97
97
|
|
98
|
-
def child_from_xml(model,
|
98
|
+
def child_from_xml(model, values)
|
99
99
|
model.child_mapper ||= CustomModelChild.new
|
100
|
-
model.child_mapper.street =
|
101
|
-
model.child_mapper.city =
|
100
|
+
model.child_mapper.street = values.first.find_child_by_name("street").text
|
101
|
+
model.child_mapper.city = values.first.find_child_by_name("city").text
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -67,8 +67,8 @@ class CustomSerialization < Lutaml::Model::Serializable
|
|
67
67
|
doc.add_element(parent, el)
|
68
68
|
end
|
69
69
|
|
70
|
-
def name_from_xml(model,
|
71
|
-
model.full_name =
|
70
|
+
def name_from_xml(model, values)
|
71
|
+
model.full_name = values.first.text.sub(/^XML Masterpiece: /, "")
|
72
72
|
end
|
73
73
|
|
74
74
|
def size_to_xml(model, parent, doc)
|
@@ -85,8 +85,8 @@ class CustomSerialization < Lutaml::Model::Serializable
|
|
85
85
|
doc.add_element(parent, color_element)
|
86
86
|
end
|
87
87
|
|
88
|
-
def color_from_xml(model,
|
89
|
-
model.color =
|
88
|
+
def color_from_xml(model, values)
|
89
|
+
model.color = values.first.text.downcase
|
90
90
|
end
|
91
91
|
|
92
92
|
def description_to_xml(model, parent, doc)
|
@@ -118,8 +118,8 @@ class GrammarInfo < Lutaml::Model::Serializable
|
|
118
118
|
doc["part_of_speech"] = model.part_of_speech
|
119
119
|
end
|
120
120
|
|
121
|
-
def part_of_speech_from_xml(model,
|
122
|
-
model.part_of_speech =
|
121
|
+
def part_of_speech_from_xml(model, nodes)
|
122
|
+
model.part_of_speech = nodes.first.text
|
123
123
|
end
|
124
124
|
|
125
125
|
def part_of_speech_to_xml(model, parent, doc)
|
@@ -105,8 +105,8 @@ module MultipleMapping
|
|
105
105
|
doc.add_element(parent, el)
|
106
106
|
end
|
107
107
|
|
108
|
-
def name_from_xml(model,
|
109
|
-
model.full_name =
|
108
|
+
def name_from_xml(model, values)
|
109
|
+
model.full_name = values.first.text.sub(/^XML Model: /, "")
|
110
110
|
end
|
111
111
|
|
112
112
|
def color_to_xml(model, parent, doc)
|
@@ -115,8 +115,8 @@ module MultipleMapping
|
|
115
115
|
doc.add_element(parent, el)
|
116
116
|
end
|
117
117
|
|
118
|
-
def color_from_xml(model,
|
119
|
-
model.color =
|
118
|
+
def color_from_xml(model, values)
|
119
|
+
model.color = values.first.text.downcase
|
120
120
|
end
|
121
121
|
|
122
122
|
def size_to_xml(model, parent, doc)
|
@@ -125,8 +125,8 @@ module MultipleMapping
|
|
125
125
|
doc.add_element(parent, el)
|
126
126
|
end
|
127
127
|
|
128
|
-
def size_from_xml(model,
|
129
|
-
model.size = (
|
128
|
+
def size_from_xml(model, values)
|
129
|
+
model.size = (values.first.text.to_i || 0) - 10
|
130
130
|
end
|
131
131
|
|
132
132
|
def desc_to_xml(model, parent, doc)
|
@@ -135,8 +135,8 @@ module MultipleMapping
|
|
135
135
|
doc.add_element(parent, el)
|
136
136
|
end
|
137
137
|
|
138
|
-
def desc_from_xml(model,
|
139
|
-
model.description =
|
138
|
+
def desc_from_xml(model, values)
|
139
|
+
model.description = values.first.text.sub(/^XML Description: /, "")
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lutaml-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|