ea 0.6.1 → 0.6.3

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: 3a6b13ab2e5a68f41b230f1fd2df41b731b1e4eb0f7674f3ac720058e01ae47a
4
- data.tar.gz: 6c11746d6dcc3584255ceb6743ad839d42316683e708430d6a49cf26a33cd018
3
+ metadata.gz: 30948ffbe1b205fa0b81592a415220b40290c7e25890d86d3f990687b73fa5d1
4
+ data.tar.gz: d7f7a976f844b0f4e907240420a440f2d6a44517a7fa40c08c51a2015b82dbcb
5
5
  SHA512:
6
- metadata.gz: a1b0e67c0f2ff7d666a1bc3429cd7f2b21166b824f98011c2ff9ca2cfe91975ab44700f75981e3c87685ed79addafa83dfd55a416a0fc8a781f20783c73ef191
7
- data.tar.gz: fb05b17d8bf3ccd7b218627379844b6cf5086798bd001883abbabbb0b05f3ad63aa0c803a6dbe625c0252d5bb7b6283114a4776bbb8d2adee58f8cb978d22d87
6
+ metadata.gz: 4c1f3f1d29dbf3da60e970a39c45006ba616b711f11b734d03f8ddcb91956573989c04faf60eb20e9cb0e7ec4f91ac6fc6c6c4e0138b90e58cf90f320aac2483
7
+ data.tar.gz: f6c8bce31c33ca03a08cb1d4e54e150c2d21d9c933caf439effc7cb160d3fdd76a962f9942973add8de49fb26baf1f2b9807d4d029f156a293a9a595a686fb5b
@@ -109,39 +109,9 @@ module Ea
109
109
  def serialize(with_extensions: true)
110
110
  xml = build_root.to_xml(use_prefix: true)
111
111
  xml = normalize_namespaces(xml)
112
- xml = plain_parameter_type(xml)
113
112
  with_extensions ? inject_extension_content(xml) : xml
114
113
  end
115
114
 
116
- # EA writes a return parameter's type unprefixed:
117
- # `<ownedParameter … type="EAnone_void"/>`. Its reference export
118
- # carries 12 of these and no `xmi:type` on ownedParameter at all.
119
- #
120
- # `xmi:type` is the XMI metaclass discriminator; `type` is the
121
- # classifier reference. Two different attributes — but
122
- # lutaml-model matches by local name and collapses them into one
123
- # slot, so the xmi gem can only emit one of them. It keeps the
124
- # namespaced form, which is right for general UML XMI, and
125
- # rewriting that in the shared model would break round-tripping
126
- # for every non-Sparx consumer. Restoring the reference EA
127
- # actually writes is this exporter's job, so it happens here.
128
- #
129
- # Scoped to ownedParameter: no other element wants it. Walks
130
- # complete name="value" pairs rather than scanning the tag as
131
- # text — a parameter name is free text out of EA and may itself
132
- # contain the literal `xmi:type=`, which a raw substitution
133
- # would happily rewrite inside the quotes.
134
- ATTRIBUTE_PAIR = /([A-Za-z_][\w:.-]*)=("[^"]*")/
135
-
136
- def plain_parameter_type(xml)
137
- xml.gsub(/<ownedParameter\b[^>]*?>/m) do |tag|
138
- tag.gsub(ATTRIBUTE_PAIR) do
139
- name = Regexp.last_match(1)
140
- name == "xmi:type" ? %(type=#{Regexp.last_match(2)}) : Regexp.last_match(0)
141
- end
142
- end
143
- end
144
-
145
115
  # EA's reference XMI uses the 2011-07-01 XMI/UML namespace URIs;
146
116
  # the xmi gem's Root model hard-codes 2013-10-01. Post-process
147
117
  # the serialized XML to match EA's namespace version. This is a
@@ -744,7 +714,11 @@ module Ea
744
714
  ),
745
715
  name: "return",
746
716
  direction: "return",
747
- type: type_reference(op.type, op.classifier),
717
+ # EA writes the classifier reference as the UNPREFIXED
718
+ # type= attribute; the xmi-namespaced xmi:type is the
719
+ # metaclass discriminator and stays unset here. The xmi
720
+ # gem's classifier_type slot round-trips EA's spelling.
721
+ classifier_type: type_reference(op.type, op.classifier),
748
722
  )
749
723
  end
750
724
 
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.1"
7
+ VERSION = "0.6.3"
8
8
  end
@@ -57,6 +57,37 @@ module Ea
57
57
  def stereotype
58
58
  @model.stereotype&.first
59
59
  end
60
+
61
+ def owned_attributes
62
+ Array(@model.attributes).filter_map do |owned_attr|
63
+ ::Ea::Xmi::LiquidDrops::AttributeDrop.new(owned_attr, @options)
64
+ end
65
+ end
66
+
67
+ def generalization
68
+ if @model.generalization
69
+ ::Ea::Xmi::LiquidDrops::GeneralizationDrop.new(
70
+ @model.generalization, nil, @options
71
+ )
72
+ end
73
+ end
74
+
75
+ def upper_packaged_element
76
+ e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
77
+ e&.name
78
+ end
79
+
80
+ def subtype_of
81
+ @lookup.find_subtype_of_from_generalization(@model.xmi_id) ||
82
+ @lookup.find_subtype_of_from_owned_attribute_type(@model.xmi_id)
83
+ end
84
+
85
+ def inheritances
86
+ Array(@inheritance_ids).filter_map do |inheritance_id|
87
+ connector = @lookup.fetch_connector(inheritance_id)
88
+ ::Ea::Xmi::LiquidDrops::ConnectorDrop.new(connector, @options)
89
+ end
90
+ end
60
91
  end
61
92
  end
62
93
  end
@@ -12,7 +12,10 @@ module Ea
12
12
  @xmi_root_model = options[:xmi_root_model]
13
13
  @id_name_mapping = options[:id_name_mapping]
14
14
 
15
- init_xmi_dependencies if @xmi_root_model
15
+ # Drops are built for template rendering where the model
16
+ # may be absent (guidance-only lookups); the dependency
17
+ # walk needs a model to anchor on.
18
+ init_xmi_dependencies if @xmi_root_model && @model
16
19
  init_guidance(guidance) if guidance
17
20
  end
18
21
 
data/lib/ea/xmi/parser.rb CHANGED
@@ -442,6 +442,11 @@ module Ea
442
442
  data_type.operations = build_operations(dt)
443
443
  data_type.associations = build_associations(dt.id)
444
444
  data_type.constraints = build_constraints(dt.id)
445
+ data_type.association_generalization = build_assoc_generalizations(dt)
446
+ # build_generalization always returns a Generalization for the
447
+ # element itself, so only attach when XMI declares a parent.
448
+ data_type.generalization =
449
+ build_generalization(dt) if dt.generalization&.any?
445
450
  end
446
451
  end
447
452
  end
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.1
4
+ version: 0.6.3
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-09-08 00:00:00.000000000 Z
11
+ date: 2026-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.7'
75
+ version: 0.7.5
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.7'
82
+ version: 0.7.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: nokogiri
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -140,22 +140,16 @@ dependencies:
140
140
  name: lutaml-uml
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '0.5'
146
143
  - - ">="
147
144
  - !ruby/object:Gem::Version
148
- version: 0.5.2
145
+ version: '0'
149
146
  type: :development
150
147
  prerelease: false
151
148
  version_requirements: !ruby/object:Gem::Requirement
152
149
  requirements:
153
- - - "~>"
154
- - !ruby/object:Gem::Version
155
- version: '0.5'
156
150
  - - ">="
157
151
  - !ruby/object:Gem::Version
158
- version: 0.5.2
152
+ version: '0'
159
153
  - !ruby/object:Gem::Dependency
160
154
  name: rubocop
161
155
  requirement: !ruby/object:Gem::Requirement