Method: Archimate::DataModel::Element#merge

Defined in:
lib/archimate/data_model/element.rb

#merge(element) ⇒ Object

Copy any attributes/docs, etc. from each of the others into the original.

1. Child `label`s with different `xml:lang` attribute values
2. Child `documentation` (and different `xml:lang` attribute values)
3. Child `properties`
4. Any other elements


57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/archimate/data_model/element.rb', line 57

def merge(element)
  if !documentation
    self.documentation = element.documentation
  elsif documentation != element.documentation
    documentation.merge(element.documentation)
  end
  element.properties.each do |property|
    unless properties.find { |my_prop| my_prop.property_definition.name == property.property_definition.name && my_prop.value == property.value}
      properties << property
    end
  end
end