Class: Lutaml::Uml::Document

Inherits:
Model::Serializable
  • Object
show all
Defined in:
lib/lutaml/uml/document.rb

Instance Method Summary collapse

Instance Method Details

#associations_from_yaml(model, values) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/lutaml/uml/document.rb', line 64

def associations_from_yaml(model, values)
  associations = values.map do |value|
    value["owner_end"] = model.name if value["owner_end"].nil?
    Association.from_yaml(value.to_yaml)
  end

  model.associations = associations
end

#associations_to_yaml(model, doc) ⇒ Object



57
58
59
60
61
62
# File 'lib/lutaml/uml/document.rb', line 57

def associations_to_yaml(model, doc)
  return unless model.associations

  associations = model.associations.map(&:to_hash)
  doc["associations"] = associations unless associations.empty?
end