Class: Jekyll::Archimate::UnifiedModel

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/archimate/unified_model.rb

Overview

This is the top level object used by the web Archimate Navigator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ UnifiedModel

Returns a new instance of UnifiedModel.



9
10
11
# File 'lib/jekyll/archimate/unified_model.rb', line 9

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/jekyll/archimate/unified_model.rb', line 7

def model
  @model
end

Instance Method Details

#diagramsObject



28
29
30
# File 'lib/jekyll/archimate/unified_model.rb', line 28

def diagrams
  model.diagrams.map { |diagram| DiagramEntity.new(diagram).to_h }
end

#elementsObject



20
21
22
# File 'lib/jekyll/archimate/unified_model.rb', line 20

def elements
  model.elements.map { |element| ElementEntity.new(element, model: model).to_h }
end

#entitiesObject



32
33
34
35
36
37
38
39
40
# File 'lib/jekyll/archimate/unified_model.rb', line 32

def entities
  [ModelEntity.new(model).to_h].concat(
    elements
  ).concat(
    relationships
  ).concat(
    diagrams
  )
end

#foldersObject



42
43
44
# File 'lib/jekyll/archimate/unified_model.rb', line 42

def folders
  [Folder.new(model.organizations.last).to_h]
end

#relationshipsObject



24
25
26
# File 'lib/jekyll/archimate/unified_model.rb', line 24

def relationships
  model.relationships.map { |relationship| RelationshipEntity.new(relationship, model: model).to_h }
end

#to_hObject



13
14
15
16
17
18
# File 'lib/jekyll/archimate/unified_model.rb', line 13

def to_h
  {
    entities: entities,
    folders: folders
  }
end