Class: Ea::Sources::Qea::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/sources/qea/adapter.rb

Overview

Driving port: produces an Ea::Model::Document from a parsed Ea::Qea::Database. Walks the SQLite-derived collections once and delegates to per-domain builders (OCP/MECE — new model types or source columns touch one builder).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, qea_path = nil) ⇒ Adapter

Returns a new instance of Adapter.



13
14
15
16
# File 'lib/ea/sources/qea/adapter.rb', line 13

def initialize(database, qea_path = nil)
  @database = database
  @qea_path = qea_path
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



11
12
13
# File 'lib/ea/sources/qea/adapter.rb', line 11

def database
  @database
end

#qea_pathObject (readonly)

Returns the value of attribute qea_path.



11
12
13
# File 'lib/ea/sources/qea/adapter.rb', line 11

def qea_path
  @qea_path
end

Class Method Details

.from_path(qea_path) ⇒ Object

Convenience: build a document directly from a .qea file path. The file is parsed via the existing Ea::Qea pipeline.



20
21
22
# File 'lib/ea/sources/qea/adapter.rb', line 20

def self.from_path(qea_path)
  new(Ea.parse(qea_path), qea_path).to_document
end

Instance Method Details

#to_documentObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/ea/sources/qea/adapter.rb', line 24

def to_document
  Ea::Model::Document.new(
    metadata: ,
    packages: packages,
    classifiers: classifiers,
    relationships: relationships,
    stereotypes: stereotypes,
    diagrams: diagrams
  )
end