ea 0.6.153 → 0.6.155

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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ea/cli/app.rb +8 -2
  3. data/lib/ea/cli/command/base.rb +1 -3
  4. data/lib/ea/cli/command/convert.rb +2 -2
  5. data/lib/ea/cli/command/diagrams.rb +4 -4
  6. data/lib/ea/cli/command/export.rb +1 -1
  7. data/lib/ea/cli/command/info.rb +1 -1
  8. data/lib/ea/cli/command/list.rb +2 -2
  9. data/lib/ea/cli/command/render.rb +1 -2
  10. data/lib/ea/cli/command/svg.rb +1 -1
  11. data/lib/ea/cli/command/validate.rb +1 -3
  12. data/lib/ea/cli/error.rb +1 -1
  13. data/lib/ea/cli/output.rb +1 -1
  14. data/lib/ea/diagram/display_config.rb +1 -1
  15. data/lib/ea/export/json/generator.rb +5 -5
  16. data/lib/ea/export/json_schema/generator.rb +2 -2
  17. data/lib/ea/export/plantuml/generator.rb +2 -2
  18. data/lib/ea/fonts/metrics.rb +3 -4
  19. data/lib/ea/lint/rules/cyclic_generalization.rb +1 -1
  20. data/lib/ea/lint/rules/duplicate_name.rb +1 -1
  21. data/lib/ea/lint/rules/missing_stereotype.rb +4 -3
  22. data/lib/ea/lint/rules/naming_convention.rb +11 -11
  23. data/lib/ea/lint/rules/orphan_element.rb +6 -6
  24. data/lib/ea/mdg/document.rb +0 -1
  25. data/lib/ea/mdg/loader.rb +0 -1
  26. data/lib/ea/mdg/xml/technology.rb +1 -1
  27. data/lib/ea/mdg/xml.rb +0 -1
  28. data/lib/ea/mdg.rb +0 -1
  29. data/lib/ea/model/document.rb +2 -2
  30. data/lib/ea/model/ghost_label.rb +0 -1
  31. data/lib/ea/model/legend.rb +1 -1
  32. data/lib/ea/model/property.rb +1 -1
  33. data/lib/ea/qea/benchmark.rb +9 -13
  34. data/lib/ea/qea/database.rb +26 -28
  35. data/lib/ea/qea/factory/association_builder.rb +5 -5
  36. data/lib/ea/qea/factory/association_transformer.rb +3 -6
  37. data/lib/ea/qea/factory/attribute_transformer.rb +3 -3
  38. data/lib/ea/qea/factory/base_transformer.rb +4 -4
  39. data/lib/ea/qea/factory/class_transformer.rb +5 -5
  40. data/lib/ea/qea/factory/constraint_transformer.rb +2 -2
  41. data/lib/ea/qea/factory/data_type_transformer.rb +5 -7
  42. data/lib/ea/qea/factory/diagram_transformer.rb +3 -7
  43. data/lib/ea/qea/factory/document_builder.rb +33 -37
  44. data/lib/ea/qea/factory/ea_to_uml_factory.rb +12 -18
  45. data/lib/ea/qea/factory/enum_transformer.rb +1 -2
  46. data/lib/ea/qea/factory/generalization_builder.rb +9 -9
  47. data/lib/ea/qea/factory/generalization_transformer.rb +3 -5
  48. data/lib/ea/qea/factory/instance_transformer.rb +3 -8
  49. data/lib/ea/qea/factory/operation_transformer.rb +2 -4
  50. data/lib/ea/qea/factory/package_transformer.rb +3 -3
  51. data/lib/ea/qea/factory/reference_resolver.rb +1 -1
  52. data/lib/ea/qea/factory/stereotype_loader.rb +1 -5
  53. data/lib/ea/qea/file_detector.rb +6 -12
  54. data/lib/ea/qea/infrastructure/database_connection.rb +1 -3
  55. data/lib/ea/qea/infrastructure/schema_reader.rb +4 -4
  56. data/lib/ea/qea/infrastructure/table_reader.rb +1 -1
  57. data/lib/ea/qea/models/ea_attribute.rb +1 -2
  58. data/lib/ea/qea/models/ea_attribute_tag.rb +1 -2
  59. data/lib/ea/qea/models/ea_author.rb +1 -1
  60. data/lib/ea/qea/models/ea_diagram_link.rb +4 -8
  61. data/lib/ea/qea/models/ea_diagram_object.rb +3 -4
  62. data/lib/ea/qea/models/ea_document.rb +4 -5
  63. data/lib/ea/qea/models/ea_glossary.rb +1 -1
  64. data/lib/ea/qea/models/ea_list.rb +1 -1
  65. data/lib/ea/qea/models/ea_object.rb +2 -2
  66. data/lib/ea/qea/models/ea_object_constraint.rb +1 -2
  67. data/lib/ea/qea/models/ea_object_property.rb +1 -2
  68. data/lib/ea/qea/models/ea_operation.rb +1 -2
  69. data/lib/ea/qea/models/ea_phase.rb +1 -1
  70. data/lib/ea/qea/models/ea_script.rb +5 -6
  71. data/lib/ea/qea/models/ea_tagged_value.rb +2 -3
  72. data/lib/ea/qea/models/ea_version.rb +1 -1
  73. data/lib/ea/qea/models/ea_xref.rb +6 -7
  74. data/lib/ea/qea/repositories/base_repository.rb +1 -1
  75. data/lib/ea/qea/services/database_loader.rb +2 -4
  76. data/lib/ea/qea/validation/association_validator.rb +12 -12
  77. data/lib/ea/qea/validation/attribute_validator.rb +25 -26
  78. data/lib/ea/qea/validation/base_validator.rb +5 -5
  79. data/lib/ea/qea/validation/class_validator.rb +34 -34
  80. data/lib/ea/qea/validation/database/circular_reference_validator.rb +7 -7
  81. data/lib/ea/qea/validation/database/ocl_constraint_validator.rb +3 -3
  82. data/lib/ea/qea/validation/database/orphan_validator.rb +5 -7
  83. data/lib/ea/qea/validation/database/referential_integrity_validator.rb +39 -39
  84. data/lib/ea/qea/validation/diagram_validator.rb +39 -39
  85. data/lib/ea/qea/validation/formatters/json_formatter.rb +16 -16
  86. data/lib/ea/qea/validation/formatters/text_formatter.rb +10 -10
  87. data/lib/ea/qea/validation/operation_validator.rb +13 -14
  88. data/lib/ea/qea/validation/package_validator.rb +18 -18
  89. data/lib/ea/qea/validation/validation_engine.rb +5 -5
  90. data/lib/ea/qea/validation/validation_message.rb +56 -73
  91. data/lib/ea/qea/validation/validation_result.rb +6 -6
  92. data/lib/ea/qea/verification/comparison_result.rb +13 -21
  93. data/lib/ea/qea/verification/document_normalizer.rb +6 -12
  94. data/lib/ea/qea/verification/document_verifier.rb +39 -39
  95. data/lib/ea/qea/verification/element_comparator.rb +27 -31
  96. data/lib/ea/qea/verification/structure_matcher.rb +10 -10
  97. data/lib/ea/qea.rb +5 -7
  98. data/lib/ea/query/builder.rb +3 -3
  99. data/lib/ea/render/image_converter.rb +5 -3
  100. data/lib/ea/shapescript/parser.rb +4 -4
  101. data/lib/ea/sources/qea/classifier_builder.rb +7 -3
  102. data/lib/ea/sources/qea/context_diagram_support.rb +2 -2
  103. data/lib/ea/sources/qea/diagram_builder/routing.rb +4 -4
  104. data/lib/ea/sources/qea/diagram_builder.rb +80 -51
  105. data/lib/ea/sources/qea/id_normalizer.rb +0 -1
  106. data/lib/ea/sources/qea/instance_builder.rb +2 -2
  107. data/lib/ea/sources/qea/legend_builder.rb +1 -1
  108. data/lib/ea/sources/qea/note_builder.rb +4 -4
  109. data/lib/ea/sources/xmi/diagram_builder/stereotype_profiles.rb +1 -1
  110. data/lib/ea/sources/xmi/extension_style_parser.rb +2 -2
  111. data/lib/ea/sources/xmi/property_builder.rb +10 -2
  112. data/lib/ea/sources/xmi/relationship_builder.rb +10 -2
  113. data/lib/ea/sources/xmi/relationship_type_map.rb +1 -1
  114. data/lib/ea/sources/xmi/tag_builder.rb +1 -1
  115. data/lib/ea/sources/xmi/type_classifier_map.rb +1 -1
  116. data/lib/ea/spa/configuration.rb +2 -4
  117. data/lib/ea/spa/generator.rb +3 -3
  118. data/lib/ea/spa/output/strategy.rb +7 -5
  119. data/lib/ea/spa/projector.rb +21 -17
  120. data/lib/ea/svg/connector_router.rb +5 -3
  121. data/lib/ea/svg/ea_emitter/background.rb +0 -1
  122. data/lib/ea/svg/ea_emitter/bounds_calculator.rb +8 -10
  123. data/lib/ea/svg/ea_emitter/canvas.rb +1 -1
  124. data/lib/ea/svg/ea_emitter/color_resolver.rb +1 -1
  125. data/lib/ea/svg/ea_emitter/compartment/note_body.rb +1 -1
  126. data/lib/ea/svg/ea_emitter/connector_redock.rb +6 -3
  127. data/lib/ea/svg/ea_emitter/diagram_frame.rb +2 -2
  128. data/lib/ea/svg/ea_emitter/document.rb +1 -1
  129. data/lib/ea/svg/ea_emitter/element/attribute_renderer.rb +2 -4
  130. data/lib/ea/svg/ea_emitter/element/compartment_geometry.rb +18 -14
  131. data/lib/ea/svg/ea_emitter/element/header_line_pipeline.rb +6 -5
  132. data/lib/ea/svg/ea_emitter/element/header_line_provider/name.rb +1 -3
  133. data/lib/ea/svg/ea_emitter/element/header_line_provider/stereotype_label.rb +1 -1
  134. data/lib/ea/svg/ea_emitter/element/icon_renderer.rb +1 -1
  135. data/lib/ea/svg/ea_emitter/element/legend_renderer.rb +1 -1
  136. data/lib/ea/svg/ea_emitter/element/note_shape_renderer.rb +5 -5
  137. data/lib/ea/svg/ea_emitter/element/operation_renderer.rb +2 -3
  138. data/lib/ea/svg/ea_emitter/element/package_shape_renderer.rb +3 -4
  139. data/lib/ea/svg/ea_emitter/element/stereotype_icon_renderer.rb +1 -1
  140. data/lib/ea/svg/ea_emitter/elements.rb +64 -63
  141. data/lib/ea/svg/ea_emitter/ghost_labels.rb +0 -1
  142. data/lib/ea/svg/ea_emitter/label/end_label.rb +7 -7
  143. data/lib/ea/svg/ea_emitter/labels.rb +1 -1
  144. data/lib/ea/svg/ea_emitter/layer_sequencer.rb +5 -5
  145. data/lib/ea/svg/ea_emitter/marker/arrow_path.rb +4 -2
  146. data/lib/ea/svg/ea_emitter/marker/open_triangle.rb +4 -4
  147. data/lib/ea/svg/ea_emitter/markers.rb +3 -1
  148. data/lib/ea/svg/ea_emitter/render_context.rb +1 -1
  149. data/lib/ea/svg/ea_emitter/text_renderer.rb +15 -4
  150. data/lib/ea/theme/definition.rb +17 -17
  151. data/lib/ea/transformers/qea_to_xmi/context.rb +1 -1
  152. data/lib/ea/transformers/qea_to_xmi/run_state.rb +1 -1
  153. data/lib/ea/transformers/qea_to_xmi/transformer.rb +44 -44
  154. data/lib/ea/transformers/qea_to_xmi/visibility.rb +3 -3
  155. data/lib/ea/version.rb +1 -1
  156. data/lib/ea/xmi/liquid_drops/connector_drop.rb +2 -2
  157. data/lib/ea/xmi/liquid_drops/enum_drop.rb +4 -4
  158. data/lib/ea/xmi/liquid_drops/generalization_attribute_drop.rb +2 -8
  159. data/lib/ea/xmi/liquid_drops/generalization_drop.rb +3 -3
  160. data/lib/ea/xmi/liquid_drops/package_drop.rb +9 -9
  161. data/lib/ea/xmi/liquid_drops/root_drop.rb +1 -1
  162. data/lib/ea/xmi/loader.rb +5 -11
  163. data/lib/ea/xmi/lookup_service.rb +3 -3
  164. data/lib/ea/xmi/parser.rb +75 -81
  165. data/lib/ea/xmi/slicer.rb +16 -12
  166. data/lib/ea/xref_format/legend_definition.rb +31 -0
  167. data/lib/ea/xref_format/parser.rb +146 -0
  168. data/lib/ea/xref_format/property_definition.rb +25 -0
  169. data/lib/ea/xref_format/record.rb +37 -0
  170. data/lib/ea/xref_format/stereotype_application.rb +33 -0
  171. data/lib/ea/xref_format.rb +36 -0
  172. data/lib/ea.rb +1 -0
  173. metadata +26 -25
  174. data/lib/ea/sources/qea/xref/legend_definition.rb +0 -35
  175. data/lib/ea/sources/qea/xref/parser.rb +0 -150
  176. data/lib/ea/sources/qea/xref/property_definition.rb +0 -29
  177. data/lib/ea/sources/qea/xref/record.rb +0 -41
  178. data/lib/ea/sources/qea/xref/stereotype_application.rb +0 -37
@@ -61,11 +61,22 @@ module Ea
61
61
  # boxes without offsets); EA always has a position, so render
62
62
  # at the origin rather than crashing the whole diagram.
63
63
  def format_attrs
64
- %(x="#{format('%.2f', x.to_f)}" y="#{format('%.2f', y.to_f)}")
64
+ %(x="#{format("%.2f", x.to_f)}" y="#{format("%.2f", y.to_f)}")
65
65
  end
66
66
 
67
67
  def format_style
68
- "font-family:#{family}; font-weight:#{weight}; font-style:#{style}; font-size:#{size}#{size_unit}; fill:#{fill};fill-opacity:1.00; stroke:#{stroke_in_text}; stroke-opacity:0.00 stroke-width:0; white-space: pre;"
68
+ "font-family:#{escape_attr(family)}; font-weight:#{weight}; " \
69
+ "font-style:#{escape_attr(style)}; font-size:#{size}#{size_unit}; " \
70
+ "fill:#{escape_attr(fill)};fill-opacity:1.00; " \
71
+ "stroke:#{escape_attr(stroke_in_text)}; stroke-opacity:0.00 " \
72
+ "stroke-width:0; white-space: pre;"
73
+ end
74
+
75
+ # EA-stored font names and theme colors flow into a double-quoted
76
+ # XML attribute; escape them so a stray quote cannot break the
77
+ # document. Special-char-free values render byte-identical.
78
+ def escape_attr(value)
79
+ XmlEscape.call(value.to_s)
69
80
  end
70
81
 
71
82
  # Per-codepoint advance widths (em), least-squares fitted from
@@ -161,7 +172,7 @@ module Ea
161
172
  WIDTH_CACHE = {}
162
173
 
163
174
  class << self
164
- def estimate_width(text, size, _width_factor = nil, family: nil,
175
+ def estimate_width(text, size, _width_factor = nil, family: nil, # rubocop:disable Metrics/ParameterLists
165
176
  weight: nil, style: nil, logical_height: nil,
166
177
  legend_title: false)
167
178
  opts = { family: family, weight: weight, style: style,
@@ -210,7 +221,7 @@ module Ea
210
221
  end
211
222
 
212
223
  def formatted_transform
213
- "rotate(#{format('%<r>.2f', r: rotation)} #{format('%.2f', x.to_f)} #{format('%.2f', y.to_f)})"
224
+ "rotate(#{format("%<r>.2f", r: rotation)} #{format("%.2f", x.to_f)} #{format("%.2f", y.to_f)})"
214
225
  end
215
226
 
216
227
  def escaped_content
@@ -191,29 +191,29 @@ module Ea
191
191
  :markers, :package, :note, :fills
192
192
 
193
193
  DEFAULT_GEOMETRY = Geometry.new(inset_left: 35, inset_right: 50,
194
- inset_top: 40, inset_bottom: 57).freeze
194
+ inset_top: 40, inset_bottom: 57).freeze
195
195
  DEFAULT_FRAME = FrameSpec.new(inset: 6, tab_height: 20, tab_slant: 13,
196
- tab_label_x: 11, tab_label_y: 19,
197
- tab_padding: 7).freeze
196
+ tab_label_x: 11, tab_label_y: 19,
197
+ tab_padding: 7).freeze
198
198
  DEFAULT_COMPARTMENTS = CompartmentSpec.new(header_top_padding: 12,
199
- header_line_offset: 6,
200
- divider_offset: 8,
201
- attr_line_offset: 6,
202
- attr_first_offset: 7,
203
- op_line_offset: 4).freeze
199
+ header_line_offset: 6,
200
+ divider_offset: 8,
201
+ attr_line_offset: 6,
202
+ attr_first_offset: 7,
203
+ op_line_offset: 4).freeze
204
204
  DEFAULT_ATTR = AttrSpec.new(visibility_x_offset: 5,
205
- content_x_offset: 20).freeze
205
+ content_x_offset: 20).freeze
206
206
  DEFAULT_MARKERS = MarkerSpec.new(diamond_half_width: 5,
207
- diamond_half_height: 10,
208
- triangle_half_base: 6,
209
- triangle_height: 11,
210
- arrow_half_base: 6,
211
- arrow_height: 11).freeze
207
+ diamond_half_height: 10,
208
+ triangle_half_base: 6,
209
+ triangle_height: 11,
210
+ arrow_half_base: 6,
211
+ arrow_height: 11).freeze
212
212
  DEFAULT_PACKAGE = PackageSpec.new(tab_height: 20,
213
- tab_label_padding: 10,
214
- default_tab_width: 105).freeze
213
+ tab_label_padding: 10,
214
+ default_tab_width: 105).freeze
215
215
  DEFAULT_NOTE = NoteSpec.new(fold_size: 12, text_x_offset: 5,
216
- text_y_offset: 12, line_height: 13).freeze
216
+ text_y_offset: 12, line_height: 13).freeze
217
217
 
218
218
  def initialize(id:, name: nil, font_family: nil, font_size: nil,
219
219
  label_font_family: nil, label_font_size: nil,
@@ -137,4 +137,4 @@ module Ea
137
137
  end
138
138
  end
139
139
  end
140
- end
140
+ end
@@ -85,7 +85,7 @@ module Ea
85
85
  Binding.new(
86
86
  fields["Variable"] || "",
87
87
  fields["Value"] || "",
88
- fields["Op"] || "",
88
+ fields["Op"] || ""
89
89
  )
90
90
  end
91
91
 
@@ -40,8 +40,8 @@ module Ea
40
40
  "Association" => :association,
41
41
  "Aggregation" => :association,
42
42
  "Composition" => :association,
43
- "Dependency" => :dependency,
44
- "Usage" => :dependency,
43
+ "Dependency" => :dependency,
44
+ "Usage" => :dependency
45
45
  }.freeze
46
46
 
47
47
  # OCP registry: maps EaObject#transformer_type to the builder
@@ -53,12 +53,12 @@ module Ea
53
53
  # run inside the Transformer instance and can call its private
54
54
  # helpers without `send`/`public_send` dispatch.
55
55
  CLASSIFIER_BUILDERS = {
56
- class: ->(obj) { build_class(obj) },
56
+ class: ->(obj) { build_class(obj) },
57
57
  enumeration: ->(obj) { build_enumeration(obj) },
58
- data_type: ->(obj) { build_data_type(obj) },
59
- signal: ->(obj) { build_class(obj, xmi_type: "uml:Signal") },
60
- instance: ->(obj) { build_instance(obj) },
61
- association_element: ->(obj) { build_association_element(obj) },
58
+ data_type: ->(obj) { build_data_type(obj) },
59
+ signal: ->(obj) { build_class(obj, xmi_type: "uml:Signal") },
60
+ instance: ->(obj) { build_instance(obj) },
61
+ association_element: ->(obj) { build_association_element(obj) }
62
62
  }.freeze
63
63
 
64
64
  # What each builder in CLASSIFIER_BUILDERS actually emits, keyed
@@ -142,8 +142,8 @@ module Ea
142
142
 
143
143
  if xml.include?("<xmi:Extension")
144
144
  xml.sub(%r{<xmi:Extension ([^>]+)>\s*</xmi:Extension>},
145
- "<xmi:Extension \\1>\n#{content}\n\t</xmi:Extension>")
146
- .sub(/<xmi:Extension ([^>]+)\/>/,
145
+ "<xmi:Extension \\1>\n#{content}\n\t</xmi:Extension>")
146
+ .sub(%r{<xmi:Extension ([^>]+)/>},
147
147
  "<xmi:Extension \\1>\n#{content}\n\t</xmi:Extension>")
148
148
  else
149
149
  xml
@@ -158,7 +158,7 @@ module Ea
158
158
  ::Xmi::Sparx::Root.new(
159
159
  documentation: build_documentation,
160
160
  model: build_model,
161
- extension: build_extension,
161
+ extension: build_extension
162
162
  )
163
163
  end
164
164
 
@@ -166,7 +166,7 @@ module Ea
166
166
  ::Xmi::Documentation.new(
167
167
  exporter: EXPORTER,
168
168
  exporter_version: EXPORTER_VERSION,
169
- exporter_id: BUILD_ID,
169
+ exporter_id: BUILD_ID
170
170
  )
171
171
  end
172
172
 
@@ -174,7 +174,7 @@ module Ea
174
174
  ::Xmi::Uml::UmlModel.new(
175
175
  type: "uml:Model",
176
176
  name: MODEL_NAME,
177
- packaged_element: root_packages.map { |pkg| build_package(pkg) } + profile_elements,
177
+ packaged_element: root_packages.map { |pkg| build_package(pkg) } + profile_elements
178
178
  )
179
179
  end
180
180
 
@@ -184,8 +184,8 @@ module Ea
184
184
 
185
185
  def root_packages
186
186
  @database.packages
187
- .select(&:root?)
188
- .sort_by { |p| [p.tpos || 0, p.name.to_s] }
187
+ .select(&:root?)
188
+ .sort_by { |p| [p.tpos || 0, p.name.to_s] }
189
189
  end
190
190
 
191
191
  # MDG stereotype definitions to include in the model tree.
@@ -203,7 +203,7 @@ module Ea
203
203
  id: @context.xmi_id_for(pkg, prefix: "EAPK"),
204
204
  name: pkg.name,
205
205
  owned_comment: package_comments(pkg),
206
- packaged_element: package_children(pkg),
206
+ packaged_element: package_children(pkg)
207
207
  )
208
208
  end
209
209
 
@@ -211,7 +211,7 @@ module Ea
211
211
  [
212
212
  *subpackages(pkg),
213
213
  *classifier_objects(pkg),
214
- *package_level_relationships(pkg),
214
+ *package_level_relationships(pkg)
215
215
  ].compact
216
216
  end
217
217
 
@@ -409,7 +409,7 @@ module Ea
409
409
  interface_realization: interface_realizations_for(obj),
410
410
  owned_attribute: attributes_for(obj),
411
411
  owned_operation: operations_for(obj),
412
- nested_classifier: nested_children_for(obj),
412
+ nested_classifier: nested_children_for(obj)
413
413
  )
414
414
  end
415
415
 
@@ -425,7 +425,7 @@ module Ea
425
425
  id: @context.xmi_id_for(obj),
426
426
  name: obj.name,
427
427
  visibility: Visibility.from_scope(obj.scope),
428
- owned_literal: enum_literals(obj),
428
+ owned_literal: enum_literals(obj)
429
429
  )
430
430
  end
431
431
 
@@ -436,7 +436,7 @@ module Ea
436
436
  name: obj.name,
437
437
  visibility: Visibility.from_scope(obj.scope),
438
438
  owned_attribute: attributes_for(obj),
439
- owned_operation: operations_for(obj),
439
+ owned_operation: operations_for(obj)
440
440
  )
441
441
  end
442
442
 
@@ -447,7 +447,7 @@ module Ea
447
447
  name: obj.name,
448
448
  visibility: Visibility.from_scope(obj.scope),
449
449
  classifier: classifier_ref_for(obj),
450
- slot: slots_for(obj),
450
+ slot: slots_for(obj)
451
451
  )
452
452
  end
453
453
 
@@ -465,7 +465,7 @@ module Ea
465
465
  type: "uml:Comment",
466
466
  id: @context.xmi_id_for(obj),
467
467
  body_element: (Ea::Rtf.to_text(obj.note) if obj.note) ||
468
- obj.name || "",
468
+ obj.name || ""
469
469
  )
470
470
  end
471
471
 
@@ -517,7 +517,7 @@ module Ea
517
517
  is_derived: Visibility.boolean_from_flag(attr.derived),
518
518
  uml_type: type_reference_model(attr.type, attr.classifier),
519
519
  upper_value: upper,
520
- lower_value: lower,
520
+ lower_value: lower
521
521
  )
522
522
  end
523
523
 
@@ -530,7 +530,7 @@ module Ea
530
530
  is_abstract: Visibility.boolean_from_flag(op.abstract),
531
531
  is_query: Visibility.boolean_from_flag(op.pure),
532
532
  concurrency: normalize_concurrency(op.concurrency),
533
- owned_parameter: operation_parameters(op),
533
+ owned_parameter: operation_parameters(op)
534
534
  )
535
535
  end
536
536
 
@@ -538,7 +538,7 @@ module Ea
538
538
  ::Xmi::Uml::OwnedLiteral.new(
539
539
  type: "uml:EnumerationLiteral",
540
540
  id: @context.xmi_id_for(attr),
541
- name: attr.name,
541
+ name: attr.name
542
542
  )
543
543
  end
544
544
 
@@ -549,7 +549,7 @@ module Ea
549
549
  ::Xmi::Uml::AssociationGeneralization.new(
550
550
  type: "uml:Generalization",
551
551
  id: @context.xmi_id_for(conn),
552
- general: @context.xmi_id_for(parent),
552
+ general: @context.xmi_id_for(parent)
553
553
  )
554
554
  end
555
555
 
@@ -575,7 +575,7 @@ module Ea
575
575
  type: "uml:Dependency",
576
576
  id: @context.xmi_id_for(conn),
577
577
  client: client,
578
- supplier: supplier,
578
+ supplier: supplier
579
579
  )
580
580
  end
581
581
 
@@ -607,9 +607,9 @@ module Ea
607
607
  name: conn.name,
608
608
  member_ends: [
609
609
  ::Xmi::Uml::MemberEnd.new(idref: dest_end.xmi_id),
610
- ::Xmi::Uml::MemberEnd.new(idref: src_end.xmi_id),
610
+ ::Xmi::Uml::MemberEnd.new(idref: src_end.xmi_id)
611
611
  ],
612
- owned_end: [dest_end.model, src_end.model],
612
+ owned_end: [dest_end.model, src_end.model]
613
613
  )
614
614
  end
615
615
 
@@ -640,7 +640,7 @@ module Ea
640
640
  association: @context.xmi_id_for(conn),
641
641
  uml_type: target_ref ? ::Xmi::Uml::Type.new(idref: target_ref) : nil,
642
642
  upper_value: upper,
643
- lower_value: lower,
643
+ lower_value: lower
644
644
  )
645
645
 
646
646
  AssociationEnd.new(end_id, model)
@@ -657,9 +657,9 @@ module Ea
657
657
  id: @context.id_allocator.allocate(
658
658
  prefix: IdAllocator::LITERAL_INTEGER,
659
659
  seed: seed,
660
- owner_id: owner_id,
660
+ owner_id: owner_id
661
661
  ),
662
- value: Cardinality.normalize_upper(raw),
662
+ value: Cardinality.normalize_upper(raw)
663
663
  )
664
664
  end
665
665
 
@@ -669,9 +669,9 @@ module Ea
669
669
  id: @context.id_allocator.allocate(
670
670
  prefix: IdAllocator::LITERAL_INTEGER,
671
671
  seed: seed,
672
- owner_id: owner_id,
672
+ owner_id: owner_id
673
673
  ),
674
- value: Cardinality.normalize_lower(raw),
674
+ value: Cardinality.normalize_lower(raw)
675
675
  )
676
676
  end
677
677
 
@@ -679,8 +679,8 @@ module Ea
679
679
 
680
680
  def operation_parameters(op)
681
681
  params = @context.params_for_operation(op.operationid)
682
- .reject(&:return?)
683
- .map { |p| build_owned_parameter(p) }
682
+ .reject(&:return?)
683
+ .map { |p| build_owned_parameter(p) }
684
684
  params << build_return_parameter(op) if synthesized_return?(op)
685
685
  params
686
686
  end
@@ -702,7 +702,7 @@ module Ea
702
702
  ::Xmi::Uml::OwnedParameter.new(
703
703
  id: @context.xmi_id_for(param),
704
704
  name: param.name,
705
- direction: normalize_direction(param.kind),
705
+ direction: normalize_direction(param.kind)
706
706
  )
707
707
  end
708
708
 
@@ -711,7 +711,7 @@ module Ea
711
711
  id: @context.id_allocator.allocate(
712
712
  prefix: IdAllocator::RETURN_PARAMETER,
713
713
  seed: "return-#{op.operationid}",
714
- owner_id: @context.xmi_id_for(op),
714
+ owner_id: @context.xmi_id_for(op)
715
715
  ),
716
716
  name: "return",
717
717
  direction: "return",
@@ -719,7 +719,7 @@ module Ea
719
719
  # type= attribute; the xmi-namespaced xmi:type is the
720
720
  # metaclass discriminator and stays unset here. The xmi
721
721
  # gem's classifier_type slot round-trips EA's spelling.
722
- classifier_type: type_reference(op.type, op.classifier),
722
+ classifier_type: type_reference(op.type, op.classifier)
723
723
  )
724
724
  end
725
725
 
@@ -789,7 +789,7 @@ module Ea
789
789
  end
790
790
 
791
791
  def note?(obj)
792
- obj.object_type == "Note" || obj.object_type == "Text"
792
+ %w[Note Text].include?(obj.object_type)
793
793
  end
794
794
 
795
795
  def package_object?(obj)
@@ -880,7 +880,7 @@ module Ea
880
880
  type: "uml:Slot",
881
881
  id: slot_id_for(instance, binding),
882
882
  defining_feature: defining_feature_for(instance, binding),
883
- value: [build_slot_value(instance, binding)],
883
+ value: [build_slot_value(instance, binding)]
884
884
  )
885
885
  end
886
886
 
@@ -888,7 +888,7 @@ module Ea
888
888
  ::Xmi::Uml::OpaqueExpression.new(
889
889
  type: "uml:OpaqueExpression",
890
890
  id: opaque_expression_id_for(instance, binding),
891
- body_attribute: binding.body,
891
+ body_attribute: binding.body
892
892
  )
893
893
  end
894
894
 
@@ -896,7 +896,7 @@ module Ea
896
896
  @context.id_allocator.allocate(
897
897
  prefix: IdAllocator::SLOT,
898
898
  seed: "slot-#{instance.ea_object_id}-#{binding.variable}",
899
- owner_id: @context.xmi_id_for(instance),
899
+ owner_id: @context.xmi_id_for(instance)
900
900
  )
901
901
  end
902
902
 
@@ -904,7 +904,7 @@ module Ea
904
904
  @context.id_allocator.allocate(
905
905
  prefix: IdAllocator::OPAQUE_EXPRESSION,
906
906
  seed: "oe-#{instance.ea_object_id}-#{binding.variable}",
907
- owner_id: @context.xmi_id_for(instance),
907
+ owner_id: @context.xmi_id_for(instance)
908
908
  )
909
909
  end
910
910
 
@@ -920,7 +920,7 @@ module Ea
920
920
  return nil unless classifier
921
921
 
922
922
  attr = @context.attributes_for(classifier.ea_object_id)
923
- .find { |a| a.name == binding.variable }
923
+ .find { |a| a.name == binding.variable }
924
924
  attr ? @context.xmi_id_for(attr) : nil
925
925
  end
926
926
  end
@@ -24,20 +24,20 @@ module Ea
24
24
  "public" => "public",
25
25
  "private" => "private",
26
26
  "protected" => "protected",
27
- "package" => "package",
27
+ "package" => "package"
28
28
  }.freeze
29
29
 
30
30
  SCOPE_MAP = {
31
31
  0 => "public",
32
32
  1 => "private",
33
33
  2 => "protected",
34
- 3 => "package",
34
+ 3 => "package"
35
35
  }.freeze
36
36
 
37
37
  AGGREGATION_MAP = {
38
38
  0 => nil,
39
39
  1 => "shared",
40
- 2 => "composite",
40
+ 2 => "composite"
41
41
  }.freeze
42
42
 
43
43
  module_function
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.153"
7
+ VERSION = "0.6.155"
8
8
  end
@@ -36,12 +36,12 @@ module Ea
36
36
 
37
37
  def source
38
38
  ::Ea::Xmi::LiquidDrops::SourceTargetDrop.new(@model.source,
39
- @options)
39
+ @options)
40
40
  end
41
41
 
42
42
  def target
43
43
  ::Ea::Xmi::LiquidDrops::SourceTargetDrop.new(@model.target,
44
- @options)
44
+ @options)
45
45
  end
46
46
 
47
47
  def recognized?
@@ -34,10 +34,10 @@ module Ea
34
34
 
35
35
  # @return name of the upper packaged element
36
36
  def upper_packaged_element
37
- if @options[:with_gen]
38
- e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
39
- e&.name
40
- end
37
+ return unless @options[:with_gen]
38
+
39
+ e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
40
+ e&.name
41
41
  end
42
42
 
43
43
  def subtype_of
@@ -4,7 +4,7 @@ module Ea
4
4
  module Xmi
5
5
  module LiquidDrops
6
6
  class GeneralizationAttributeDrop < Liquid::Drop
7
- def initialize(attr, upper_klass, gen_name, guidance = nil) # rubocop:disable Lint/MissingSuper,Metrics/ParameterLists,Layout/LineLength
7
+ def initialize(attr, upper_klass, gen_name, guidance = nil) # rubocop:disable Lint/MissingSuper
8
8
  @attr = attr
9
9
  @upper_klass = upper_klass
10
10
  @gen_name = gen_name
@@ -51,13 +51,7 @@ module Ea
51
51
  @attr.type_ns
52
52
  end
53
53
 
54
- def upper_klass
55
- @upper_klass
56
- end
57
-
58
- def gen_name
59
- @gen_name
60
- end
54
+ attr_reader :upper_klass, :gen_name
61
55
 
62
56
  def name_ns
63
57
  @attr.name_ns
@@ -25,9 +25,9 @@ module Ea
25
25
  end
26
26
 
27
27
  def general
28
- if @gen.general
29
- GeneralizationDrop.new(@gen.general, @guidance, @options)
30
- end
28
+ return unless @gen.general
29
+
30
+ GeneralizationDrop.new(@gen.general, @guidance, @options)
31
31
  end
32
32
 
33
33
  def has_general?
@@ -41,9 +41,9 @@ module Ea
41
41
  @guidance,
42
42
  @options.merge(
43
43
  {
44
- absolute_path: "#{@options[:absolute_path]}::#{name}",
45
- },
46
- ),
44
+ absolute_path: "#{@options[:absolute_path]}::#{name}"
45
+ }
46
+ )
47
47
  )
48
48
  end
49
49
  end
@@ -75,9 +75,9 @@ module Ea
75
75
  @guidance,
76
76
  @options.merge(
77
77
  {
78
- absolute_path: "#{@options[:absolute_path]}::#{name}",
79
- },
80
- ),
78
+ absolute_path: "#{@options[:absolute_path]}::#{name}"
79
+ }
80
+ )
81
81
  )
82
82
  end
83
83
  end
@@ -89,9 +89,9 @@ module Ea
89
89
  @guidance,
90
90
  @options.merge(
91
91
  {
92
- absolute_path: "#{@options[:absolute_path]}::#{name}",
93
- },
94
- ),
92
+ absolute_path: "#{@options[:absolute_path]}::#{name}"
93
+ }
94
+ )
95
95
  )
96
96
  end
97
97
  end
@@ -21,7 +21,7 @@ module Ea
21
21
  def packages
22
22
  Array(@model.packages).map do |package|
23
23
  ::Ea::Xmi::LiquidDrops::PackageDrop.new(package, @guidance,
24
- @options)
24
+ @options)
25
25
  end
26
26
  end
27
27
 
data/lib/ea/xmi/loader.rb CHANGED
@@ -32,7 +32,7 @@ module Ea
32
32
  parser: parser,
33
33
  uml_document: uml_document,
34
34
  drop_options: build_drop_options(parser),
35
- xmi_id_index: build_xmi_id_index(uml_document),
35
+ xmi_id_index: build_xmi_id_index(uml_document)
36
36
  )
37
37
  end
38
38
 
@@ -48,7 +48,7 @@ module Ea
48
48
  lookup: lookup,
49
49
  with_gen: true,
50
50
  with_assoc: true,
51
- with_absolute_path: true,
51
+ with_absolute_path: true
52
52
  }
53
53
  end
54
54
 
@@ -57,15 +57,9 @@ module Ea
57
57
  index = {}
58
58
  collect = lambda do |container|
59
59
  index[container.xmi_id] ||= container if container.respond_to?(:xmi_id)
60
- if container.respond_to?(:classes)
61
- container.classes.each { |n| index[n.xmi_id] ||= n }
62
- end
63
- if container.respond_to?(:data_types)
64
- container.data_types.each { |n| index[n.xmi_id] ||= n }
65
- end
66
- if container.respond_to?(:enums)
67
- container.enums.each { |n| index[n.xmi_id] ||= n }
68
- end
60
+ container.classes.each { |n| index[n.xmi_id] ||= n } if container.respond_to?(:classes)
61
+ container.data_types.each { |n| index[n.xmi_id] ||= n } if container.respond_to?(:data_types)
62
+ container.enums.each { |n| index[n.xmi_id] ||= n } if container.respond_to?(:enums)
69
63
  (container.packages || []).each { |p| collect.call(p) } if container.respond_to?(:packages)
70
64
  end
71
65
  collect.call(uml_document)
@@ -111,9 +111,9 @@ module Ea
111
111
 
112
112
  def build_dependency_index(&key)
113
113
  index = {}
114
- parser.xmi_index
115
- .packaged_elements_of_type("uml:Dependency")
116
- .each do |dep|
114
+ @parser.xmi_index
115
+ .packaged_elements_of_type("uml:Dependency")
116
+ .each do |dep|
117
117
  (index[key.call(dep)] ||= []) << dep
118
118
  end
119
119
  index