Class: Archimate::FileFormats::Sax::Archi::Connection

Inherits:
Handler
  • Object
show all
Includes:
Style, CaptureDocumentation, CaptureProperties
Defined in:
lib/archimate/file_formats/sax/archi/connection.rb

Instance Attribute Summary

Attributes inherited from Handler

#attrs, #element_type, #name, #parent_handler

Instance Method Summary collapse

Methods included from CaptureProperties

#on_property, #properties

Methods included from CaptureDocumentation

#documentation, #on_preserved_lang_string

Methods included from Style

#style

Methods inherited from Handler

#characters, #diagram, #event, #method_missing, #process_text, #property_definitions, #respond_to_missing?

Constructor Details

#initialize(name, attrs, parent_handler) ⇒ Connection

Returns a new instance of Connection.



12
13
14
15
# File 'lib/archimate/file_formats/sax/archi/connection.rb', line 12

def initialize(name, attrs, parent_handler)
  super
  @bendpoints = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Archimate::FileFormats::Sax::Handler

Instance Method Details

#completeObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/archimate/file_formats/sax/archi/connection.rb', line 17

def complete
  connection = DataModel::Connection.new(
    id: @attrs["id"],
    type: @attrs["xsi:type"],
    source: nil,
    target: nil,
    relationship: nil,
    name: @attrs["name"],
    style: style,
    bendpoints: @bendpoints,
    documentation: documentation,
    properties: properties,
    diagram: diagram
  )
  [
    event(:on_connection, connection),
    event(:on_referenceable, connection),
    event(:on_future, Sax::FutureReference.new(connection, :source, @attrs["source"])),
    event(:on_future, Sax::FutureReference.new(connection, :target, @attrs["target"])),
    event(:on_future, Sax::FutureReference.new(connection, :relationship, @attrs["relationship"] || @attrs["archimateRelationship"]))
  ]
end

#on_location(location, _source) ⇒ Object



40
41
42
43
# File 'lib/archimate/file_formats/sax/archi/connection.rb', line 40

def on_location(location, _source)
  @bendpoints << location
  false
end