Class: Lutaml::Uml::DataType

Inherits:
Classifier show all
Defined in:
lib/lutaml/uml/data_type.rb

Direct Known Subclasses

PrimitiveType

Instance Method Summary collapse

Methods inherited from TopElement

#definition_from_yaml, #definition_to_yaml, #full_name_from_yaml, #full_name_to_yaml

Instance Method Details

#associations_from_yaml(model, values) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/lutaml/uml/data_type.rb', line 51

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



44
45
46
47
48
49
# File 'lib/lutaml/uml/data_type.rb', line 44

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

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