ea 0.6.75 → 0.6.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ed01c20dde26afa762488af94cfc743a2627d863447060bfc45e427665ba441
4
- data.tar.gz: 16fb60b4b1ff368c628d777d5c964822f1ea7d686b940e873ffafdd0a766f9a3
3
+ metadata.gz: 0b1e7133efe6db7f9c0dcf1f73749934b1887107b4fa37a9c5ac26b10a1c90f9
4
+ data.tar.gz: 8b9d00b0893ac03f2c8608e4faf0b9a12ed7d29413a4bc230e1e88ed205afdd8
5
5
  SHA512:
6
- metadata.gz: 4751045cd01f51df9c5646f2f9fb6406f64eb56e448a22167fbe7c3c68c5ec59c4362af94c6482d9e7924e4d181d0d4e0076a8cbe71f5bbb89d67c943863addb
7
- data.tar.gz: c2a282c40d85667f6b104fd1891487cce5f375ad526022bb2ff82a181d89eb36363acc5dc9a933a318d5a260117030c058c0ec8ea374ca5df114b2dc478eb86d
6
+ metadata.gz: 86ef660cb14f997a030c8969e6ee1184d5b73b1cc97d1000954dd888dff587490a0b2e80450e98f0ee36cc5324c2ece05b740f12e2bb8391288ff12edf2d9b80
7
+ data.tar.gz: f714a37fe94c165bff0104f545e7ba9332c6b3d91ec1bb7cd62524c72b1940992182f558af1343e35d2ff693b675a8ade451f3b7e04793a4ebbdc76a331fd5c2
@@ -17,6 +17,7 @@ module Ea
17
17
  # column value is non-numeric; rendered as-is by the SVG line
18
18
  # builder while computed-unbounded uppers render as "*".
19
19
  attribute :multiplicity_upper_raw, :string # -1 means "many"
20
+ attribute :multiplicity_lower_raw, :string # literal text bounds ("size")
20
21
  # Verbatim stored cardinality text (e.g. "*", "1..1", "n") for
21
22
  # association ends; EA renders connector-end multiplicities
22
23
  # exactly as stored rather than from parsed bounds.
@@ -30,6 +30,7 @@ module Ea
30
30
  type_name: normalize_type(row.type),
31
31
  qualified_name: "#{owner_object.name}::#{row.name}",
32
32
  multiplicity_lower: parse_lower(row),
33
+ multiplicity_lower_raw: raw_bound(row.lowerbound),
33
34
  multiplicity_upper_raw: raw_upper(row),
34
35
  multiplicity_upper: parse_upper(row),
35
36
  default_value: row.default,
@@ -52,7 +53,17 @@ module Ea
52
53
  # render as "*" (verified against EA-published SVGs).
53
54
  def raw_upper(row)
54
55
  raw = row.upperbound.to_s
55
- raw.match?(/\A[nN]\z/) ? raw.downcase : nil
56
+ return raw.downcase if raw.match?(/\A[nN]\z/)
57
+
58
+ raw_bound(raw)
59
+ end
60
+
61
+ # Literal text bounds EA displays verbatim in brackets
62
+ # ('elements: Character [size]' - LowerBound/UpperBound both
63
+ # 'size').
64
+ def raw_bound(value)
65
+ raw = value.to_s
66
+ raw.empty? || raw.match?(/\A\d+\z/) ? nil : raw
56
67
  end
57
68
 
58
69
  def normalize_type(type)
@@ -100,8 +100,16 @@ module Ea
100
100
  def multiplicity
101
101
  lower = property.multiplicity_lower
102
102
  upper = property.multiplicity_upper
103
+ if lower == 1 && upper == 1
104
+ raw = property.multiplicity_lower_raw
105
+ # Literal text bounds EA displays verbatim ('elements:
106
+ # Character [size]' - stored bounds 'size'/'size' parse
107
+ # to the 1..1 default).
108
+ return "[#{raw}]" if raw && raw == property.multiplicity_upper_raw
109
+
110
+ return ""
111
+ end
103
112
  return "" if lower.nil? && upper.nil?
104
- return "" if lower == 1 && upper == 1
105
113
 
106
114
  "[#{lower || 0}..#{bound_text(upper)}]"
107
115
  end
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.75"
7
+ VERSION = "0.6.77"
8
8
  end
@@ -4,13 +4,26 @@ module Ea
4
4
  module Xmi
5
5
  module LiquidDrops
6
6
  class DataTypeDrop < Liquid::Drop
7
- def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
7
+ def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
8
8
  @model = model
9
+ @guidance = guidance
9
10
  @options = options
10
11
  @lookup = options[:lookup]
11
12
  @xmi_root_model = options[:xmi_root_model]
13
+
14
+ init_guidance(guidance) if guidance
12
15
  end
13
16
 
17
+ private
18
+
19
+ def init_guidance(guidance)
20
+ @data_type_guidance = guidance["data_types"]&.find do |data_type|
21
+ data_type["name"] == name || data_type["name"] == absolute_path
22
+ end
23
+ end
24
+
25
+ public
26
+
14
27
  def xmi_id
15
28
  @model.xmi_id
16
29
  end
@@ -19,6 +32,20 @@ module Ea
19
32
  @model.name
20
33
  end
21
34
 
35
+ def absolute_path
36
+ absolute_path_arr = [@model.name]
37
+ e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
38
+ absolute_path_arr << e.name if e
39
+
40
+ while e
41
+ e = @lookup.find_upper_level_packaged_element(e.id)
42
+ absolute_path_arr << e.name if e
43
+ end
44
+
45
+ absolute_path_arr << "::#{@xmi_root_model.model.name}"
46
+ absolute_path_arr.reverse.join("::")
47
+ end
48
+
22
49
  def attributes
23
50
  Array(@model.attributes).filter_map do |owned_attr|
24
51
  if @options[:with_assoc] || owned_attr.association.nil?
@@ -67,11 +94,15 @@ module Ea
67
94
  def generalization
68
95
  if @model.generalization
69
96
  ::Ea::Xmi::LiquidDrops::GeneralizationDrop.new(
70
- @model.generalization, nil, @options
97
+ @model.generalization, @data_type_guidance, @options
71
98
  )
72
99
  end
73
100
  end
74
101
 
102
+ def has_guidance?
103
+ !!@data_type_guidance
104
+ end
105
+
75
106
  def upper_packaged_element
76
107
  e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
77
108
  e&.name
@@ -57,7 +57,8 @@ module Ea
57
57
 
58
58
  def data_types
59
59
  Array(@model.data_types).map do |data_type|
60
- ::Ea::Xmi::LiquidDrops::DataTypeDrop.new(data_type, @options)
60
+ ::Ea::Xmi::LiquidDrops::DataTypeDrop.new(data_type, @guidance,
61
+ @options)
61
62
  end
62
63
  end
63
64
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.75
4
+ version: 0.6.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-11 00:00:00.000000000 Z
11
+ date: 2026-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model