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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fe23c8f2af27bf3016adc461338dab47dcbf0179237fef38e2b30ef068e2adc
4
- data.tar.gz: 2382b0189342f7e559129af75829c642b4737f934cc2a83821cb2300484813d3
3
+ metadata.gz: '00689211648c9cfcc32eed2a9ef1e49c3992096cdc6441eae5c96bff2ce7830d'
4
+ data.tar.gz: 6be87ad65a48ef86856042a929538bc525ad9f6f347005bcfe1425c5c376ee58
5
5
  SHA512:
6
- metadata.gz: a722350e941888b75fd6437fc7e2b491247cfae144414b400c49d77f522b38cea9b70579010f3bb6bfc5b859058cba6985e65b885e997780bd1aa6d7c3be40b8
7
- data.tar.gz: 160e71a7c27b78b4d2c582a8de3b6b3fc1815e3f1c915b487cf0dbd06ddd7436ddb0b18e331b4c76483f621982fd2ce0697744b5cd25620436c8374c9bae513f
6
+ metadata.gz: 2693eb3a76f8ec311dc24e9af82dc549783156fabb7139afe2d8cfac3c28b27b9ad2bb7a9e5dc562ef4864963b52eddcff287075fc881284ac292020d83df3fb
7
+ data.tar.gz: d238a14995787d8555f7292c4354703d007a6ebb7f3908f7a10cbe599363f6d0ab646006d21933992dd9ecabab1ad3827c0d517d9ceb67ebe51eb41cc2a349ba
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.2".freeze
2
+ VERSION = "0.9.3".freeze
3
3
  end
@@ -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: owned_literals,
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.