lutaml 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/formatter/graphviz.rb +1 -1
- data/lib/lutaml/uml/formatter/graphviz.rb +3 -3
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +2 -2
- data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +1 -17
- data/lib/lutaml/xmi/parsers/xml.rb +5 -19
- 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: 93f9a0221445cede27f5be5af6f7f4d71071180dbb4feb400fc173b7c52f9b1a
|
4
|
+
data.tar.gz: 446307e5c65bd65f6b891b50ab1c0383008c5ccc8e8b9c49cb131ea18cf4ce5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364b04c40839d9da343e9c8d4fe9a7b950ad37f6ed1e893c5bcd44fafd80ef6d4cdcbe9eac387e4f8f50a230489dc3e9c6129f4bf151d95045e7b6c01a4de565
|
7
|
+
data.tar.gz: 425d8bdab371363eac85459c753aadd278a199a47a8f60e7390d419b6cb06afefa85d2dd13be54de3976f21857f8a244fe8e94faf8dfabaf4b10441146367281
|
@@ -148,13 +148,13 @@ module Lutaml
|
|
148
148
|
if node.owner_end_attribute_name
|
149
149
|
attributes["headlabel"] = format_label(
|
150
150
|
node.owner_end_attribute_name,
|
151
|
-
node.owner_end_cardinality
|
151
|
+
node.owner_end_cardinality,
|
152
152
|
)
|
153
153
|
end
|
154
154
|
if node.member_end_attribute_name
|
155
155
|
attributes["taillabel"] = format_label(
|
156
156
|
node.member_end_attribute_name,
|
157
|
-
node.member_end_cardinality
|
157
|
+
node.member_end_cardinality,
|
158
158
|
)
|
159
159
|
end
|
160
160
|
|
@@ -192,7 +192,7 @@ module Lutaml
|
|
192
192
|
def format_label(name, cardinality = {})
|
193
193
|
res = "+#{name}"
|
194
194
|
if cardinality.nil? ||
|
195
|
-
(cardinality[
|
195
|
+
(cardinality[:min].nil? || cardinality[:max].nil?)
|
196
196
|
return res
|
197
197
|
end
|
198
198
|
|
data/lib/lutaml/version.rb
CHANGED
@@ -3,11 +3,6 @@
|
|
3
3
|
module Lutaml
|
4
4
|
module XMI
|
5
5
|
class GeneralizationAttributeDrop < Liquid::Drop
|
6
|
-
LOWER_VALUE_MAPPINGS = {
|
7
|
-
"C" => "0",
|
8
|
-
"M" => "1",
|
9
|
-
}.freeze
|
10
|
-
|
11
6
|
def initialize(attr, upper_klass, gen_name) # rubocop:disable Lint/MissingSuper
|
12
7
|
@attr = attr
|
13
8
|
@upper_klass = upper_klass
|
@@ -35,18 +30,7 @@ module Lutaml
|
|
35
30
|
end
|
36
31
|
|
37
32
|
def cardinality
|
38
|
-
|
39
|
-
min = min.nil? ? nil : LOWER_VALUE_MAPPINGS[min]
|
40
|
-
|
41
|
-
"#{min}..#{@attr[:cardinality]['max']}"
|
42
|
-
end
|
43
|
-
|
44
|
-
def min_cardinality
|
45
|
-
@attr[:cardinality]["min"]
|
46
|
-
end
|
47
|
-
|
48
|
-
def max_cardinality
|
49
|
-
@attr[:cardinality]["max"]
|
33
|
+
::Lutaml::XMI::CardinalityDrop.new(@attr[:cardinality])
|
50
34
|
end
|
51
35
|
|
52
36
|
def definition
|
@@ -10,10 +10,6 @@ module Lutaml
|
|
10
10
|
module Parsers
|
11
11
|
# Class for parsing .xmi schema files into ::Lutaml::Uml::Document
|
12
12
|
class XML
|
13
|
-
LOWER_VALUE_MAPPINGS = {
|
14
|
-
"0" => "C",
|
15
|
-
"1" => "M",
|
16
|
-
}.freeze
|
17
13
|
attr_reader :xmi_cache, :xmi_root_model
|
18
14
|
|
19
15
|
class << self
|
@@ -255,11 +251,10 @@ module Lutaml
|
|
255
251
|
end
|
256
252
|
|
257
253
|
# @param general_node [Shale::Mapper]
|
258
|
-
#
|
254
|
+
# @return [Hash]
|
259
255
|
def get_general_attributes(general_node)
|
260
|
-
serialize_class_attributes(general_node, with_assoc: true)
|
261
|
-
|
262
|
-
# attrs.sort_by { |i| i[:name] }
|
256
|
+
attrs = serialize_class_attributes(general_node, with_assoc: true)
|
257
|
+
attrs.sort_by { |i| i[:name].to_s }
|
263
258
|
end
|
264
259
|
|
265
260
|
# @param general_node [Shale::Mapper]
|
@@ -767,20 +762,11 @@ module Lutaml
|
|
767
762
|
# @return [Hash]
|
768
763
|
def cardinality_min_max_value(min, max)
|
769
764
|
{
|
770
|
-
|
771
|
-
|
765
|
+
min: min,
|
766
|
+
max: max,
|
772
767
|
}
|
773
768
|
end
|
774
769
|
|
775
|
-
# @param value [String]
|
776
|
-
# @param is_min [Boolean]
|
777
|
-
# @return [String]
|
778
|
-
def cardinality_value(value, is_min = false)
|
779
|
-
return unless value
|
780
|
-
|
781
|
-
is_min ? LOWER_VALUE_MAPPINGS[value.to_s] : value
|
782
|
-
end
|
783
|
-
|
784
770
|
# @node [Shale::Mapper]
|
785
771
|
# @attr_name [String]
|
786
772
|
# @return [String]
|
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.
|
4
|
+
version: 0.9.17
|
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-10-
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|