Class: Archimate::FileFormats::Sax::ModelExchangeFile::Item

Inherits:
Handler
  • Object
show all
Includes:
CaptureDocumentation
Defined in:
lib/archimate/file_formats/sax/model_exchange_file/item.rb

Instance Attribute Summary

Attributes inherited from Handler

#attrs, #element_type, #name, #parent_handler

Instance Method Summary collapse

Methods included from CaptureDocumentation

#documentation, #on_preserved_lang_string

Methods inherited from Handler

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

Constructor Details

#initialize(name, attrs, parent_handler) ⇒ Item

Returns a new instance of Item.



10
11
12
13
14
15
16
17
# File 'lib/archimate/file_formats/sax/model_exchange_file/item.rb', line 10

def initialize(name, attrs, parent_handler)
  super
  @item_name = nil
  @child_items = []
  @child_organizations = []
  @identifier_ref = nil
  @organization = nil
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



19
20
21
22
23
24
25
26
27
# File 'lib/archimate/file_formats/sax/model_exchange_file/item.rb', line 19

def complete
  return [event(:on_item_reference, identifier_ref)] if identifier_ref

  [
    event(:on_organization, organization),
    event(:on_referenceable, organization),
    event(:on_future, Sax::FutureReference.new(organization, :items, @child_items))
  ]
end

#on_item_reference(ref, _source) ⇒ Object



34
35
36
37
# File 'lib/archimate/file_formats/sax/model_exchange_file/item.rb', line 34

def on_item_reference(ref, _source)
  @child_items << ref
  false
end

#on_lang_string(name, _source) ⇒ Object



39
40
41
42
# File 'lib/archimate/file_formats/sax/model_exchange_file/item.rb', line 39

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

#on_organization(organization, _source) ⇒ Object



29
30
31
32
# File 'lib/archimate/file_formats/sax/model_exchange_file/item.rb', line 29

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