Class: Archimate::FileFormats::Sax::Archi::Model

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

Instance Attribute Summary collapse

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 inherited from Handler

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

Constructor Details

#initialize(name, attrs, parent_handler) ⇒ Model

Returns a new instance of Model.



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 13

def initialize(name, attrs, parent_handler)
  super
  @property_definitions = {}
  @elements = []
  @organizations = []
  @relationships = []
  @diagrams = []
  @viewpoints = []
  @futures = []
  @index = {}
  @model = nil
end

Dynamic Method Handling

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

Instance Attribute Details

#property_definitionsObject (readonly)

Returns the value of attribute property_definitions.



11
12
13
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 11

def property_definitions
  @property_definitions
end

Instance Method Details

#completeObject



26
27
28
29
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 26

def complete
  process_futures
  [event(:on_model, model)]
end

#on_diagram(diagram, _source) ⇒ Object



46
47
48
49
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 46

def on_diagram(diagram, _source)
  @diagrams << diagram
  false
end

#on_element(element, _source) ⇒ Object



31
32
33
34
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 31

def on_element(element, _source)
  @elements << element
  false
end

#on_future(future, _source) ⇒ Object



61
62
63
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 61

def on_future(future, _source)
  @futures << future
end

#on_organization(organization, _source) ⇒ Object



36
37
38
39
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 36

def on_organization(organization, _source)
  @organizations << organization
  false
end

#on_property_definition(property_definition, _source) ⇒ Object



56
57
58
59
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 56

def on_property_definition(property_definition, _source)
  @property_definitions[property_definition.id] = property_definition
  false
end

#on_referenceable(referenceable, _source) ⇒ Object



65
66
67
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 65

def on_referenceable(referenceable, _source)
  @index[referenceable.id] = referenceable
end

#on_relationship(relationship, _source) ⇒ Object



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

def on_relationship(relationship, _source)
  @relationships << relationship
  false
end

#on_viewpoint(viewpoint, _source) ⇒ Object



51
52
53
54
# File 'lib/archimate/file_formats/sax/archi/model.rb', line 51

def on_viewpoint(viewpoint, _source)
  @viewpoints << viewpoint
  false
end