Class: Ea::Sources::Xmi::MetadataBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/sources/xmi/metadata_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, xmi_path) ⇒ MetadataBuilder

Returns a new instance of MetadataBuilder.



9
10
11
12
# File 'lib/ea/sources/xmi/metadata_builder.rb', line 9

def initialize(root, xmi_path)
  @root = root
  @xmi_path = xmi_path
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



7
8
9
# File 'lib/ea/sources/xmi/metadata_builder.rb', line 7

def root
  @root
end

#xmi_pathObject (readonly)

Returns the value of attribute xmi_path.



7
8
9
# File 'lib/ea/sources/xmi/metadata_builder.rb', line 7

def xmi_path
  @xmi_path
end

Instance Method Details

#buildObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ea/sources/xmi/metadata_builder.rb', line 14

def build
  model = root.model
  documentation = root.documentation
  Ea::Model::Metadata.new(
    id: "metadata",
    title: model&.name,
    version: documentation&.exporter_version,
    author: documentation&.exporter,
    created_date: nil,
    modified_date: documentation&.timestamp&.first&.iso8601,
    source_format: "xmi",
    source_tool: documentation&.exporter,
    source_path: xmi_path
  )
end