lutaml 0.9.2 → 0.9.4

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: e5acccff648a0423b02d608ec9beeba31b00a83374e273de15d7f9f6f5c3189a
4
+ data.tar.gz: f1e66c52754b09ee217d5e26993ec9fdbdb75d44fc0a8a360e41eabf23847dbe
5
5
  SHA512:
6
- metadata.gz: a722350e941888b75fd6437fc7e2b491247cfae144414b400c49d77f522b38cea9b70579010f3bb6bfc5b859058cba6985e65b885e997780bd1aa6d7c3be40b8
7
- data.tar.gz: 160e71a7c27b78b4d2c582a8de3b6b3fc1815e3f1c915b487cf0dbd06ddd7436ddb0b18e331b4c76483f621982fd2ce0697744b5cd25620436c8374c9bae513f
6
+ metadata.gz: 72166cd8333ff2c6158c19fe69e9072e9e534542f5ae4b95546ce6fef7433f84be3d0c8f4889929622f7a94d33033f78bc160fb76e6a020621e2e1bdfc0cb7a1
7
+ data.tar.gz: a4604dca6d1c97712ba953d3b1ef238d7cbe56003bfbbce4725937480e91d928391dc3a5e1e85e7dc1730062ce832db95b8eca4f9962e87559967985d77adaae
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.2".freeze
2
+ VERSION = "0.9.4".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"]
data/lutaml.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.add_runtime_dependency "parslet", "~> 2.0.0"
37
37
  spec.add_runtime_dependency "ruby-graphviz", "~> 1.2"
38
38
  spec.add_runtime_dependency "thor", "~> 1.0"
39
- spec.add_runtime_dependency "xmi", ">= 0.3.0"
39
+ spec.add_runtime_dependency "xmi", ">= 0.3.6"
40
40
 
41
41
  spec.add_development_dependency "byebug"
42
42
  spec.add_development_dependency "equivalent-xml", "~> 0.6.0"
metadata CHANGED
@@ -1,14 +1,14 @@
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.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-28 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.3.0
117
+ version: 0.3.6
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.3.0
124
+ version: 0.3.6
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: byebug
127
127
  requirement: !ruby/object:Gem::Requirement