Class: Jekyll::Archimate::UnifiedModel

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/archimate/archimate_hook.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.



112
113
114
# File 'lib/jekyll/archimate/archimate_hook.rb', line 112

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



110
111
112
# File 'lib/jekyll/archimate/archimate_hook.rb', line 110

def model
  @model
end

Instance Method Details

#diagramsObject



131
132
133
# File 'lib/jekyll/archimate/archimate_hook.rb', line 131

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

#elementsObject



123
124
125
# File 'lib/jekyll/archimate/archimate_hook.rb', line 123

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

#entitiesObject



135
136
137
138
139
140
# File 'lib/jekyll/archimate/archimate_hook.rb', line 135

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

#foldersObject



142
143
144
# File 'lib/jekyll/archimate/archimate_hook.rb', line 142

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

#relationshipsObject



127
128
129
# File 'lib/jekyll/archimate/archimate_hook.rb', line 127

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

#to_hObject



116
117
118
119
120
121
# File 'lib/jekyll/archimate/archimate_hook.rb', line 116

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