Class: Archimate::FileFormats::Sax::ModelExchangeFile::Model

Inherits:
Handler
  • Object
show all
Includes:
CaptureDocumentation, CaptureProperties
Defined in:
lib/archimate/file_formats/sax/model_exchange_file/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
25
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 13

def initialize(name, attrs, parent_handler)
  super
  @property_definitions = {}
  @elements = []
  @organizations = []
  @relationships = []
  @diagrams = []
  @viewpoints = []
  @futures = []
  @metadata = nil
  @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/model_exchange_file/model.rb', line 11

def property_definitions
  @property_definitions
end

Instance Method Details

#completeObject



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

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

#on_any_element(any_element, _source) ⇒ Object



76
77
78
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 76

def on_any_element(any_element, _source)
  raise "Unexpected: #{any_element.inspect}"
end

#on_diagram(diagram, _source) ⇒ Object



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

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

#on_element(element, _source) ⇒ Object



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

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

#on_future(future, _source) ⇒ Object



67
68
69
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 67

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

#on_lang_string(lang_string, _source) ⇒ Object



80
81
82
83
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 80

def on_lang_string(lang_string, _source)
  @name = lang_string
  false
end

#on_metadata(metadata, _source) ⇒ Object



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

def (, _source)
  @metadata = 
  false
end

#on_organization(organization, _source) ⇒ Object



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

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

#on_property_definition(property_definition, _source) ⇒ Object



62
63
64
65
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 62

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

#on_referenceable(referenceable, _source) ⇒ Object



71
72
73
74
# File 'lib/archimate/file_formats/sax/model_exchange_file/model.rb', line 71

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

#on_relationship(relationship, _source) ⇒ Object



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

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

#on_viewpoint(viewpoint, _source) ⇒ Object



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

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