lutaml 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/parsers/xml.rb +21 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '00689211648c9cfcc32eed2a9ef1e49c3992096cdc6441eae5c96bff2ce7830d'
|
4
|
+
data.tar.gz: 6be87ad65a48ef86856042a929538bc525ad9f6f347005bcfe1425c5c376ee58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2693eb3a76f8ec311dc24e9af82dc549783156fabb7139afe2d8cfac3c28b27b9ad2bb7a9e5dc562ef4864963b52eddcff287075fc881284ac292020d83df3fb
|
7
|
+
data.tar.gz: d238a14995787d8555f7292c4354703d007a6ebb7f3908f7a10cbe599363f6d0ab646006d21933992dd9ecabab1ad3827c0d517d9ceb67ebe51eb41cc2a349ba
|
data/lib/lutaml/version.rb
CHANGED
@@ -117,21 +117,36 @@ module Lutaml
|
|
117
117
|
def serialize_model_enums(package)
|
118
118
|
package.packaged_element.select { |e| e.type?("uml:Enumeration") }
|
119
119
|
.map do |enum|
|
120
|
-
# xpath .//ownedLiteral[@xmi:type="uml:EnumerationLiteral"]
|
121
|
-
owned_literals = enum.owned_literal.map do |owned_literal|
|
122
|
-
owned_literal.to_hash.transform_keys(&:to_sym)
|
123
|
-
end
|
124
|
-
|
125
120
|
{
|
126
121
|
xmi_id: enum.id,
|
127
122
|
name: enum.name,
|
128
|
-
values:
|
123
|
+
values: serialize_enum_owned_literal(enum),
|
129
124
|
definition: doc_node_attribute_value(enum.id, "documentation"),
|
130
125
|
stereotype: doc_node_attribute_value(enum.id, "stereotype"),
|
131
126
|
}
|
132
127
|
end
|
133
128
|
end
|
134
129
|
|
130
|
+
# @param model [Shale::Mapper]
|
131
|
+
# @return [Hash]
|
132
|
+
# @note xpath .//ownedLiteral[@xmi:type="uml:EnumerationLiteral"]
|
133
|
+
def serialize_enum_owned_literal(enum)
|
134
|
+
owned_literals = enum.owned_literal.select do |owned_literal|
|
135
|
+
owned_literal.type? "uml:EnumerationLiteral"
|
136
|
+
end
|
137
|
+
|
138
|
+
owned_literals.map do |owned_literal|
|
139
|
+
# xpath .//type
|
140
|
+
uml_type_id = owned_literal&.uml_type&.idref
|
141
|
+
|
142
|
+
{
|
143
|
+
name: owned_literal.name,
|
144
|
+
type: lookup_entity_name(uml_type_id) || uml_type_id,
|
145
|
+
definition: lookup_attribute_documentation(owned_literal.id),
|
146
|
+
}
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
135
150
|
# @param model [Shale::Mapper]
|
136
151
|
# @return [Array<Hash>]
|
137
152
|
# @note xpath ./packagedElement[@xmi:type="uml:DataType"]
|