lutaml 0.9.15 → 0.9.17

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: 4906fb3fd07954b14085e4d257c3bb856e4ca6618c60ff96dc8b0ad6c5bdb8f5
4
- data.tar.gz: c4ce20e928cf6a3b0ef7b39cae68f1f384490807638d14ba500f2d2fc6180631
3
+ metadata.gz: 93f9a0221445cede27f5be5af6f7f4d71071180dbb4feb400fc173b7c52f9b1a
4
+ data.tar.gz: 446307e5c65bd65f6b891b50ab1c0383008c5ccc8e8b9c49cb131ea18cf4ce5b
5
5
  SHA512:
6
- metadata.gz: b586629aaf671856673871f267b9622814180d2df17aa068fa70656461a038fb33658f19d604233b5ea87c2f21f2d3f9cc70ff4cb4e1ee60829c050ae651ea9a
7
- data.tar.gz: 8b32d8fb46594d2602d8c6b5a8cfbbcfab5c039d981197ee0ca087e1effb89734c389947f62dde568f5f22bf74153099d103bd1f7b211e805558ed521bb315da
6
+ metadata.gz: 364b04c40839d9da343e9c8d4fe9a7b950ad37f6ed1e893c5bcd44fafd80ef6d4cdcbe9eac387e4f8f50a230489dc3e9c6129f4bf151d95045e7b6c01a4de565
7
+ data.tar.gz: 425d8bdab371363eac85459c753aadd278a199a47a8f60e7390d419b6cb06afefa85d2dd13be54de3976f21857f8a244fe8e94faf8dfabaf4b10441146367281
@@ -189,7 +189,7 @@ module Lutaml
189
189
  def format_label(name, cardinality = {})
190
190
  res = "+#{name}"
191
191
  if cardinality.nil? ||
192
- (cardinality["min"].nil? || cardinality["max"].nil?)
192
+ (cardinality[:min].nil? || cardinality[:max].nil?)
193
193
  return res
194
194
  end
195
195
 
@@ -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["min"].nil? || cardinality["max"].nil?)
195
+ (cardinality[:min].nil? || cardinality[:max].nil?)
196
196
  return res
197
197
  end
198
198
 
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.15".freeze
2
+ VERSION = "0.9.17".freeze
3
3
  end
@@ -8,11 +8,11 @@ module Lutaml
8
8
  end
9
9
 
10
10
  def min
11
- @model["min"]
11
+ @model[:min]
12
12
  end
13
13
 
14
14
  def max
15
- @model["max"]
15
+ @model[:max]
16
16
  end
17
17
  end
18
18
  end
@@ -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
- min = @attr[:cardinality]["min"]
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
@@ -27,7 +27,7 @@ module Lutaml
27
27
  end
28
28
 
29
29
  def has_general?
30
- !@gen[:general].empty?
30
+ !!@gen[:general]
31
31
  end
32
32
 
33
33
  def attributes
@@ -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
- # # @return [Hash]
254
+ # @return [Hash]
259
255
  def get_general_attributes(general_node)
260
- serialize_class_attributes(general_node, with_assoc: true)
261
- # turn on sorting if necessary
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
- "min" => cardinality_value(min, true),
771
- "max" => cardinality_value(max, false),
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.15
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-04 00:00:00.000000000 Z
11
+ date: 2024-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid