Class: Archimate::FileFormats::ModelExchangeFileWriter21

Overview

Archimate version 2.1 Model Exchange Format Writer

Constant Summary

Constants included from Serializer::ModelExchangeFile::V21::Viewpoint

Serializer::ModelExchangeFile::V21::Viewpoint::VIEWPOINT_MAP

Instance Attribute Summary

Attributes inherited from Serializer::ModelExchangeFile::ModelExchangeFileWriter

#model

Attributes inherited from Serializer::Writer

#model

Instance Method Summary collapse

Methods included from Serializer::ModelExchangeFile::V21::Viewpoint

#viewpoint_attribute

Methods included from Serializer::ModelExchangeFile::V21::ViewNode

#serialize_view_node, #view_node_attrs

Methods included from Serializer::ModelExchangeFile::Style

#serialize_color, #serialize_font, #serialize_style

Methods included from Serializer::ModelExchangeFile::Relationship

#serialize_relationship

Methods included from Serializer::ModelExchangeFile::Properties

#serialize_properties

Methods included from Serializer::ModelExchangeFile::V21::Property

#serialize_property

Methods included from Serializer::ModelExchangeFile::V21::OrganizationBody

#serialize_organization_body

Methods included from Serializer::ModelExchangeFile::Organization

#serialize_organization

Methods included from Serializer::ModelExchangeFile::V21::Model

#model_attrs, #serialize_model

Methods included from Serializer::ModelExchangeFile::Location

#serialize_location

Methods included from Serializer::ModelExchangeFile::V21::Label

#serialize_label

Methods included from Serializer::ModelExchangeFile::V21::Item

#serialize_item

Methods included from Serializer::ModelExchangeFile::Element

#elementbase, #serialize_element

Methods included from Serializer::ModelExchangeFile::V21::Diagram

#serialize_diagram

Methods included from Serializer::ModelExchangeFile::V21::Connection

#serialize_connection

Methods inherited from Serializer::ModelExchangeFile::ModelExchangeFileWriter

#identifier, #write

Methods inherited from Serializer::Writer

#serialize, write

Constructor Details

#initialize(model) ⇒ ModelExchangeFileWriter21

Returns a new instance of ModelExchangeFileWriter21.



31
32
33
# File 'lib/archimate/file_formats/model_exchange_file_writer_21.rb', line 31

def initialize(model)
  super
end

Instance Method Details

#font_style_string(font) ⇒ Object



45
46
47
# File 'lib/archimate/file_formats/model_exchange_file_writer_21.rb', line 45

def font_style_string(font)
  font&.style_string
end

#meff_type(el_type) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/archimate/file_formats/model_exchange_file_writer_21.rb', line 49

def meff_type(el_type)
  el_type = el_type.sub(/^/, "")
  case el_type
  when 'AndJunction', 'OrJunction'
    'Junction'
  else
    el_type
  end
end

#relationship_attributes(relationship) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/archimate/file_formats/model_exchange_file_writer_21.rb', line 35

def relationship_attributes(relationship)
  rel_name = REL_NAME_MAPPING.fetch(relationship.class, relationship.type)
  {
    identifier: identifier(relationship.id),
    source: identifier(relationship.source.id),
    target: identifier(relationship.target.id),
    "xsi:type" => "#{rel_name}Relationship"
  }
end