ea 0.6.161 → 0.6.163

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: d7197145439783ffd1371d762178adb42d10fbb7bd149a35b321eb07d85bfdea
4
- data.tar.gz: 2337db7f718d4237e586bb4b77bd7ab03fe2c8ca21466be720c73a0f74bd78ba
3
+ metadata.gz: 465d786677456a7546e995e281aae3423b35178dd3087203800d1055a0f4a634
4
+ data.tar.gz: 5d2c302f55b354d18aaa47e9b826e83db46866dafef40243d70b94ff31847fe2
5
5
  SHA512:
6
- metadata.gz: 5d1728a63e4be58c217d2204e3095af3255f0e2a69ef84586ac74a3c3eb62c3ab132b8d06d31a8f139e0ab08f53160b856fa3c03f8e5a9bb5d0053b544ad9d1e
7
- data.tar.gz: 9abe04e07fb696d543c4ea5fbadba8049baea8b91fbae6276ddecd3c9bfaf7b716a576adf6bacb1c9e1dd156c87044081ae28f688095ba9277c80e522d48d46a
6
+ metadata.gz: 4fa54d905530b7e4cbd37e684e3711964646058fa89c636134cb90886b6d1a3ea32e2ae39da94134a3ac7aef597e25e6caa23ede21cf3dafd45bc0908cda7f5e
7
+ data.tar.gz: bebd88af5088bc5828e19609671f35e4d8dc87de697a324318594c7d42881fac905dac8e69ce8154add2f50c4f34ff899e33920200b20af8026823ec543fbfd6
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
- # using RuboCop version 1.92.3.
3
+ # using RuboCop version 1.93.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -158,7 +158,7 @@ Lint/Void:
158
158
  - 'lib/ea/cli/output.rb'
159
159
  - 'lib/ea/svg/ea_emitter/marker.rb'
160
160
 
161
- # Offense count: 282
161
+ # Offense count: 281
162
162
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
163
163
  Metrics/AbcSize:
164
164
  Max: 175
@@ -174,12 +174,12 @@ Metrics/BlockLength:
174
174
  Metrics/ClassLength:
175
175
  Max: 897
176
176
 
177
- # Offense count: 142
177
+ # Offense count: 143
178
178
  # Configuration parameters: AllowedMethods, AllowedPatterns.
179
179
  Metrics/CyclomaticComplexity:
180
180
  Max: 81
181
181
 
182
- # Offense count: 326
182
+ # Offense count: 333
183
183
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
184
184
  Metrics/MethodLength:
185
185
  Max: 153
@@ -194,7 +194,7 @@ Metrics/ModuleLength:
194
194
  Metrics/ParameterLists:
195
195
  Max: 33
196
196
 
197
- # Offense count: 106
197
+ # Offense count: 107
198
198
  # Configuration parameters: AllowedMethods, AllowedPatterns.
199
199
  Metrics/PerceivedComplexity:
200
200
  Max: 83
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "nokogiri"
3
+ require "moxml"
4
4
 
5
5
  module Ea
6
6
  module Export
@@ -32,26 +32,27 @@ module Ea
32
32
  def self.from_path(path, version: nil)
33
33
  return new if path.nil? || !File.exist?(path)
34
34
 
35
- from_nokogiri(Nokogiri::XML(File.read(path)), version: version)
35
+ from_document(Moxml.parse(File.read(path)), version: version)
36
36
  end
37
37
 
38
- # @param doc [Nokogiri::XML::Document]
38
+ # @param doc [Moxml::Document]
39
39
  # @param version [String, nil] GML version filter
40
40
  # @return [NamespaceRegistry]
41
- def self.from_nokogiri(doc, version: nil)
41
+ def self.from_document(doc, version: nil)
42
42
  namespaces = {}
43
43
  # EA stores the prefix in a `xmlns` attribute, which XML
44
- # reserves for namespace declarations. Nokogiri interprets
45
- # it as the element's namespace, so we read it back via
46
- # `namespace` (the parsed NS) rather than `attribute`.
47
- # Use local-name() so the lookup is namespace-agnostic.
44
+ # reserves for namespace declarations. The XML parser
45
+ # interprets it as the element's namespace, so we read it
46
+ # back via `namespace` (the parsed NS) rather than
47
+ # `attribute`. Use local-name() so the lookup is
48
+ # namespace-agnostic.
48
49
  doc.xpath("//*[local-name()='GMLNS']").each do |gmlns|
49
50
  next if version && gmlns["version"] != version
50
51
 
51
52
  gmlns.element_children.each do |node|
52
53
  next unless node.name == "Namespace"
53
54
 
54
- prefix = node.namespace&.href
55
+ prefix = node.namespace&.uri
55
56
  next unless prefix
56
57
 
57
58
  namespaces[prefix] = Namespace.new(
@@ -124,11 +124,7 @@ module Ea
124
124
 
125
125
  def build_element(obj_row, diagram_row)
126
126
  @current_obj_row = obj_row
127
- style_hash = DiagramStyleParser.parse(obj_row.objectstyle)
128
- style_hash[:stored_attribute_order] = true
129
- style_hash["connector_proxy"] = true if connector_proxy?(obj_row)
130
- fqname = stereotype_fqname_for(obj_row)
131
- style_hash[:stereotype_fqname] = fqname if fqname
127
+ style_hash = element_style_for(obj_row)
132
128
  font_style = effective_font_style(obj_row, style_hash)
133
129
  Ea::Model::DiagramElement.new(
134
130
  id: IdNormalizer.synthetic("de", diagram_row.diagram_id,
@@ -138,6 +134,28 @@ module Ea
138
134
  z_order: obj_row.sequence,
139
135
  bounds: bounds_from_rect(obj_row),
140
136
  style: style_hash,
137
+ **element_font_kwargs(font_style, style_hash),
138
+ line_width: effective_line_width(obj_row, style_hash),
139
+ line_color: effective_line_color(obj_row, style_hash),
140
+ background_color: style_hash[:bcol]&.to_i
141
+ )
142
+ end
143
+
144
+ # Style hash shared by the element build: parsed object style
145
+ # plus the stored-order, proxy and stereotype-fqname markers.
146
+ def element_style_for(obj_row)
147
+ style_hash = DiagramStyleParser.parse(obj_row.objectstyle)
148
+ style_hash[:stored_attribute_order] = true
149
+ style_hash["connector_proxy"] = true if connector_proxy?(obj_row)
150
+ fqname = stereotype_fqname_for(obj_row)
151
+ style_hash[:stereotype_fqname] = fqname if fqname
152
+ style_hash
153
+ end
154
+
155
+ # Font rendering kwargs derived from the stored style plus the
156
+ # effective font selection.
157
+ def element_font_kwargs(font_style, style_hash)
158
+ {
141
159
  font_family: presence(font_style[:font]),
142
160
  font_size: font_size_from(font_style),
143
161
  font_size_inherited: font_size_from(font_style).nil?,
@@ -146,11 +164,8 @@ module Ea
146
164
  font_bold: truthy?(style_hash[:bold]),
147
165
  font_italic: truthy?(style_hash[:italic]),
148
166
  font_underline: truthy?(style_hash[:ul]),
149
- show_tagged_values: truthy?(style_hash[:tag]),
150
- line_width: effective_line_width(obj_row, style_hash),
151
- line_color: effective_line_color(obj_row, style_hash),
152
- background_color: style_hash[:bcol]&.to_i
153
- )
167
+ show_tagged_values: truthy?(style_hash[:tag])
168
+ }
154
169
  end
155
170
 
156
171
  # EA anchors association-class links on ProxyConnector stubs and
@@ -239,14 +254,19 @@ module Ea
239
254
  target = diagram_object_placement(diagram_row.diagram_id, target_id)
240
255
  return nil unless source && target
241
256
 
242
- source_bounds = drawn_bounds_for(source)
243
- target_bounds = drawn_bounds_for(target)
244
- waypoints = if source_id == target_id
245
- self_loop_waypoints(source_bounds)
246
- else
247
- direct_waypoints(source_bounds, target_bounds)
248
- end
249
257
  Ea::Model::DiagramConnector.new(
258
+ **regenerated_common_attrs(conn, diagram_row, idx),
259
+ waypoints: regenerated_waypoints(source_id, target_id,
260
+ drawn_bounds_for(source),
261
+ drawn_bounds_for(target)),
262
+ **regenerated_render_attrs(conn)
263
+ )
264
+ end
265
+
266
+ # Identity/model-side attributes shared by every regenerated
267
+ # connector row.
268
+ def regenerated_common_attrs(conn, diagram_row, idx)
269
+ {
250
270
  id: IdNormalizer.synthetic("ec", diagram_row.diagram_id, idx),
251
271
  diagram_id: IdNormalizer.from_guid(diagram_row.ea_guid),
252
272
  relationship_ref: ref_for_raw_connector(conn),
@@ -254,22 +274,41 @@ module Ea
254
274
  direction: conn.direction,
255
275
  source_stereotype: conn.sourcestereotype,
256
276
  target_stereotype: conn.deststereotype,
257
- waypoints: waypoints,
258
277
  label_boxes: {},
259
- is_substitutable: substitutable_connector?(conn),
260
- # Only the Dependency family carries EA's double-back
261
- # "M t L s M t" byte form; regenerated generalizations
262
- # and associations draw as plain source-first lines
263
- # (0CABA7D7's gen "M 125 130 L 125 99"; 568CDFC9's
264
- # regenerated assocs).
265
- style: if conn.connector_type == "Dependency"
266
- { direct: true, regenerated: true }
267
- else
268
- { regenerated: true }
269
- end,
270
278
  hidden: false,
271
279
  has_geometry_offsets: false
272
- )
280
+ }
281
+ end
282
+
283
+ # Render-side attributes: substitution flag plus the
284
+ # regenerated style chosen by connector family.
285
+ def regenerated_render_attrs(conn)
286
+ {
287
+ is_substitutable: substitutable_connector?(conn),
288
+ style: regenerated_style(conn)
289
+ }
290
+ end
291
+
292
+ def regenerated_waypoints(source_id, target_id, source_bounds,
293
+ target_bounds)
294
+ if source_id == target_id
295
+ self_loop_waypoints(source_bounds)
296
+ else
297
+ direct_waypoints(source_bounds, target_bounds)
298
+ end
299
+ end
300
+
301
+ # Only the Dependency family carries EA's double-back
302
+ # "M t L s M t" byte form; regenerated generalizations
303
+ # and associations draw as plain source-first lines
304
+ # (0CABA7D7's gen "M 125 130 L 125 99"; 568CDFC9's
305
+ # regenerated assocs).
306
+ def regenerated_style(conn)
307
+ if conn.connector_type == "Dependency"
308
+ { direct: true, regenerated: true }
309
+ else
310
+ { regenerated: true }
311
+ end
273
312
  end
274
313
 
275
314
  # EA's regenerated self-loop: a small elbow exiting and
@@ -298,25 +337,16 @@ module Ea
298
337
  end
299
338
 
300
339
  def context_autoline(conn, diagram_row, object_id)
301
- focal = ContextDiagramSupport.focal_placements(diagram_row, database).first
302
- return nil unless focal
340
+ source_bounds, target_bounds = context_autoline_bounds(diagram_row,
341
+ object_id)
342
+ return nil unless source_bounds
303
343
 
304
- into_focal = ContextDiagramSupport.package_context(diagram_row)["variant"] == "Clients"
305
- source_id = into_focal ? object_id : focal.ea_object_id.to_i
306
- target_id = into_focal ? focal.ea_object_id.to_i : object_id
307
- source_placement = diagram_object_placement(diagram_row.diagram_id, source_id)
308
- target_placement = diagram_object_placement(diagram_row.diagram_id, target_id)
309
- return nil unless source_placement && target_placement
310
-
311
- source_bounds = drawn_bounds_for(source_placement)
312
- target_bounds = drawn_bounds_for(target_placement)
313
- waypoints = direct_waypoints(source_bounds, target_bounds)
314
344
  Ea::Model::DiagramConnector.new(
315
345
  id: IdNormalizer.synthetic("xc", diagram_row.diagram_id, object_id),
316
346
  diagram_id: IdNormalizer.from_guid(diagram_row.ea_guid),
317
347
  relationship_ref: ref_for_raw_connector(conn),
318
348
  connector_type: conn.connector_type,
319
- waypoints: waypoints,
349
+ waypoints: direct_waypoints(source_bounds, target_bounds),
320
350
  label_boxes: {},
321
351
  is_substitutable: substitutable_connector?(conn),
322
352
  style: { direct: true },
@@ -325,6 +355,33 @@ module Ea
325
355
  )
326
356
  end
327
357
 
358
+ # Focal-relative endpoints for a Clients/Providers context
359
+ # autoline; empty when the focal object or either placement
360
+ # is missing.
361
+ def context_autoline_bounds(diagram_row, object_id)
362
+ focal = ContextDiagramSupport.focal_placements(diagram_row, database).first
363
+ return [] unless focal
364
+
365
+ into_focal = ContextDiagramSupport.package_context(diagram_row)["variant"] == "Clients"
366
+ source_id, target_id = context_autoline_endpoints(into_focal, focal,
367
+ object_id)
368
+ source_placement = diagram_object_placement(diagram_row.diagram_id, source_id)
369
+ target_placement = diagram_object_placement(diagram_row.diagram_id, target_id)
370
+ return [] unless source_placement && target_placement
371
+
372
+ [drawn_bounds_for(source_placement), drawn_bounds_for(target_placement)]
373
+ end
374
+
375
+ # Clients context draws toward the focal object; Providers
376
+ # draws away from it.
377
+ def context_autoline_endpoints(into_focal, focal, object_id)
378
+ if into_focal
379
+ [object_id, focal.ea_object_id.to_i]
380
+ else
381
+ [focal.ea_object_id.to_i, object_id]
382
+ end
383
+ end
384
+
328
385
  # EA renders PHANTOM CONNECTORS for associations that exist
329
386
  # in t_connector between two elements BOTH placed on the
330
387
  # current diagram, even when no t_diagramlinks entry exists
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.161"
7
+ VERSION = "0.6.163"
8
8
  end
data/lib/ea/xmi/parser.rb CHANGED
@@ -743,13 +743,21 @@ module Ea
743
743
 
744
744
  general_item.attributes.reverse_each do |attr|
745
745
  attr.upper_klass = gen_upper_klass
746
- attr.gen_name = gen_name
747
746
  attr.level = level
748
747
 
748
+ # Inherited rows are dup copies (QeaToUml parity): the
749
+ # ancestor's own attributes keep only upper_klass/level tags,
750
+ # while the copies carry the full ancestor attribution so
751
+ # later levels cannot mutate what was already collected.
752
+ inherited_attr = attr.dup
753
+ inherited_attr.upper_klass = gen_upper_klass
754
+ inherited_attr.gen_name = gen_name
755
+ inherited_attr.level = level
756
+
749
757
  if attr.association
750
- inherited_assoc_props << attr
758
+ inherited_assoc_props << inherited_attr
751
759
  else
752
- inherited_props << attr
760
+ inherited_props << inherited_attr
753
761
  end
754
762
  end
755
763
 
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.161
4
+ version: 0.6.163
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-11-26 00:00:00.000000000 Z
11
+ date: 2026-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -81,19 +81,33 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '5'
83
83
  - !ruby/object:Gem::Dependency
84
- name: nokogiri
84
+ name: moxml
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.18'
89
+ version: '0.6'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.18'
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: leptris
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.9'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.9'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: thor
99
113
  requirement: !ruby/object:Gem::Requirement