lutaml-model 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5097f4bf4d2b95fe089f40da159330218a69558acc9e3401784f12fc566bae00
4
- data.tar.gz: 45a29395158a5362446677cfa7340b2e739a715ef7639c934f9a93a3e2b166cb
3
+ metadata.gz: da09d917512e0b5f82b847627920cb874b9bf4506ef568d95b45dd26aefef054
4
+ data.tar.gz: c31a188213089b94d752ba6e679ba8ac80f33c9f8e4f36f5bffddebf949b4a10
5
5
  SHA512:
6
- metadata.gz: 7bccace8ffeabe88a60b06e610e0b168772981d4a2b6db956f9b70f295f5522c909e0f0001fed6396fdbd44169d9a191b6b5de2d94cf6a2135bbd6a226dd7669
7
- data.tar.gz: 19ab03f407b11348eaf01f37db05151e82de56c0c9bcac1fb2e76f27597b7eea450e6d600216be5260ac04ccbe3111a858409a7a9ed33dc559397a6b885ad8fe
6
+ metadata.gz: 4b3f701841e4ac8d6b76f1afb7cccf1e2476200e9842ab1c5f3c664b4ec064f79831886963b0b7436ea16a8944158d7d50abe7a1e29b786e08486ad0fb2a0e10
7
+ data.tar.gz: c2c4ddb8166ccde0274acc9f38ba36a2058de7b3fc61c88ab82cc8f29cbc046d43e6844da874367720d59b4c35553a9cb5adccbfd17429a1be52a8f623f96992
@@ -11,6 +11,7 @@
11
11
  "glossarist/glossarist-ruby",
12
12
  "lutaml/oasis-etm",
13
13
  "lutaml/ali",
14
- "lutaml/reqif"
14
+ "lutaml/reqif",
15
+ "lutaml/lutaml-xsd"
15
16
  ]
16
17
  }
@@ -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
- return children.first
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Model
5
- VERSION = "0.6.6"
5
+ VERSION = "0.6.7"
6
6
  end
7
7
  end
@@ -43,8 +43,8 @@ module CDATA
43
43
  map_element "address", to: :address
44
44
  end
45
45
 
46
- def house_from_xml(model, node)
47
- model.house = node.children.first.text
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, node)
57
- model.city = node.children.first.text
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
 
@@ -46,8 +46,8 @@ module CollectionTests
46
46
  map_element "address", to: :address
47
47
  end
48
48
 
49
- def city_from_xml(model, node)
50
- model.city = node.text
49
+ def city_from_xml(model, nodes)
50
+ model.city = nodes.first.text
51
51
  end
52
52
 
53
53
  def city_to_xml(model, parent, doc)
@@ -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, value)
98
+ def child_from_xml(model, values)
99
99
  model.child_mapper ||= CustomModelChild.new
100
- model.child_mapper.street = value.find_child_by_name("street").text
101
- model.child_mapper.city = value.find_child_by_name("city").text
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, value)
71
- model.full_name = value.text.sub(/^XML Masterpiece: /, "")
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, value)
89
- model.color = value.text.downcase
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, node)
122
- model.part_of_speech = node.text
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, value)
109
- model.full_name = value.text.sub(/^XML Model: /, "")
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, value)
119
- model.color = value.text.downcase
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, value)
129
- model.size = (value.text.to_i || 0) - 10
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, value)
139
- model.description = value.text.sub(/^XML 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.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-21 00:00:00.000000000 Z
11
+ date: 2025-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64