ea 0.6.166 → 0.6.167

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: 7d3b5c25645d2ed2dc0bcddd625248daccabfb66bb000a0dcce9642ad8379fba
4
- data.tar.gz: 27e44f5862d326cd6a73626314a4dc03fd3e1929b1242063db9b0d2dd2d9530b
3
+ metadata.gz: 5adeaa57c0343b644501c9413dfa0a3b1e3f220ab0924ab79dc8c89e0e396047
4
+ data.tar.gz: 3d1e06b23d4c4ea4bcdfa8b5b028183f18524975bcf19f9ed1c728a3407412a4
5
5
  SHA512:
6
- metadata.gz: b79815ca68958510bfacbbb0b23e1fa1b96494f6d3b754d47724af0bc3dc674e1c1deae176202fd41681c4ce163b993eec01d6637af83cc19e5d48ec43967b37
7
- data.tar.gz: 10f1424d27e83baa36ee4d1624075585a5f560085b8cb3a55e5a264c21dd756a3317dec9a43ca8035cc67a62541985bb8375d4a8f227a84c1869d681d8ec3960
6
+ metadata.gz: f1dae66ae0da9917a1b14bb67bbb492b945cf215d357c4f3b3c0753eeee3476444da8c7b0d31e4806e7d667161f3ecb760afb9e002ddecbab8ed909ef1bf1435
7
+ data.tar.gz: bce07ec117097f324e165203745d54f145835bfe1ae7885398b294186a85640fab402e3e792b24d007c42c001c62250c4e50baea42c52dc1acfc044e9cfacf92
@@ -36,6 +36,7 @@ module Ea
36
36
  # @param guidance [Object, nil] guidance document
37
37
  # @return [ParsedResult]
38
38
  def parsed(qea_path, guidance: nil)
39
+ require_uml!
39
40
  database = Services::DatabaseLoader.new(qea_path).load
40
41
  context = Context.new(database, guidance)
41
42
  ParsedResult.new(
@@ -45,6 +46,25 @@ module Ea
45
46
  )
46
47
  end
47
48
 
49
+ # Load a .qea file into the Loaded graph shape the table
50
+ # renders consume (parser, uml_document facade, drop options,
51
+ # lazy id index) — the .qea branch of the XMI load_graph.
52
+ #
53
+ # @param qea_path [String] path to the .qea file
54
+ # @param guidance [Object, nil] guidance document
55
+ # @return [LazyGraph]
56
+ def parsed_graph(qea_path, guidance: nil)
57
+ require_uml!
58
+ database = Services::DatabaseLoader.new(qea_path).load
59
+ context = Context.new(database, guidance)
60
+ LazyGraph.new(
61
+ parser: context.parser,
62
+ uml_document: LazyDocument.new(context),
63
+ drop_options: context.drop_options,
64
+ xmi_id_index: context.xmi_id_index
65
+ )
66
+ end
67
+
48
68
  private
49
69
 
50
70
  def require_uml!
@@ -160,6 +180,95 @@ module Ea
160
180
  end
161
181
  end
162
182
 
183
+ # The Loaded graph shape the table renders consume. Classes are
184
+ # constructed per package on demand and memoized on the
185
+ # context's caches; the database stays the single source.
186
+ class LazyGraph < Struct.new(:parser, :uml_document, :drop_options,
187
+ :xmi_id_index, keyword_init: true)
188
+ end
189
+
190
+ # Document facade answering RootDrop's reads: name + packages.
191
+ class LazyDocument
192
+ def initialize(context)
193
+ @context = context
194
+ end
195
+
196
+ def name
197
+ "EA Model"
198
+ end
199
+
200
+ def packages
201
+ @context.database.packages
202
+ .reject { |package| parent(package) }
203
+ .map { |package| LazyPackage.new(@context, package) }
204
+ end
205
+
206
+ private
207
+
208
+ def parent(package)
209
+ @context.database.find_package(package.parent_id)
210
+ end
211
+ end
212
+
213
+ # Package facade over one t_package row: classes, enums, data
214
+ # types and child packages construct on demand.
215
+ class LazyPackage
216
+ def initialize(context, package)
217
+ @context = context
218
+ @package = package
219
+ end
220
+
221
+ def name
222
+ @package.name
223
+ end
224
+
225
+ def xmi_id
226
+ @package.ea_guid ? ea_id(@package.ea_guid) : nil
227
+ end
228
+
229
+ def definition
230
+ @package.notes ? Ea::Rtf.to_text(@package.notes.to_s) : nil
231
+ end
232
+
233
+ def stereotype
234
+ nil
235
+ end
236
+
237
+ def classes
238
+ @context.database.objects_in_package(@package.package_id)
239
+ .select(&:uml_class?)
240
+ .map { |row| @context.klass_for(row.ea_object_id) }
241
+ .compact
242
+ end
243
+
244
+ def enums
245
+ @context.database.objects_in_package(@package.package_id)
246
+ .select(&:enumeration?)
247
+ .filter_map { |row| @context.enum_for(row.ea_object_id) }
248
+ end
249
+
250
+ def data_types
251
+ @context.database.objects_in_package(@package.package_id)
252
+ .select(&:data_type?)
253
+ .filter_map { |row| @context.data_type_for(row.ea_object_id) }
254
+ end
255
+
256
+ def packages
257
+ @context.database.child_packages_for(@package.package_id)
258
+ .map { |row| LazyPackage.new(@context, row) }
259
+ end
260
+
261
+ def diagrams
262
+ []
263
+ end
264
+
265
+ private
266
+
267
+ def ea_id(guid)
268
+ Ea::GuidFormat.ea_guid_to_xmi_id(guid)
269
+ end
270
+ end
271
+
163
272
  # Stand-in for the xmi gem's root model: the klass-table cache
164
273
  # reads only its model name (to strip a leading path segment).
165
274
  class RootModelFacade
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.166"
7
+ VERSION = "0.6.167"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.166
4
+ version: 0.6.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.