Class: CaDOVe::XMI::UMLAssociation

Inherits:
Object
  • Object
show all
Defined in:
lib/cadove/models/XMI/document.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ UMLAssociation

Returns a new instance of UMLAssociation.



122
123
124
# File 'lib/cadove/models/XMI/document.rb', line 122

def initialize(xml)
  @xml = xml
end

Class Method Details

.all(class_element, class_name) ⇒ Object



126
127
128
129
130
131
132
# File 'lib/cadove/models/XMI/document.rb', line 126

def self.all(class_element, class_name)
  class_element.root.elements.collect("//UML:Association") do |a|
    if REXML::XPath.first(a, ".//UML:TaggedValue[@tag='ea_sourceName']") && REXML::XPath.first(a, ".//UML:TaggedValue[@tag='ea_sourceName']").attributes['value'] == class_name
      new(a)
    end
  end.compact
end

Instance Method Details

#keyObject



138
139
140
# File 'lib/cadove/models/XMI/document.rb', line 138

def key
  "#{name} (#{type})"
end

#nameObject



134
135
136
# File 'lib/cadove/models/XMI/document.rb', line 134

def name
  REXML::XPath.first(@xml, ".//UML:TaggedValue[@tag='ea_targetName']").attributes['value']
end