Class: Lutaml::Lml::UmlClass
- Inherits:
-
Model::Serializable
- Object
- Model::Serializable
- Lutaml::Lml::UmlClass
- Defined in:
- lib/lutaml/lml/models/uml_class.rb
Class Method Summary collapse
Instance Method Summary collapse
- #associations_from_yaml(model, values) ⇒ Object
- #associations_to_yaml(model, doc) ⇒ Object
- #definition_from_yaml(model, value) ⇒ Object
- #definition_to_yaml(model, doc) ⇒ Object
Class Method Details
.entity_type ⇒ Object
79 80 81 |
# File 'lib/lutaml/lml/models/uml_class.rb', line 79 def self.entity_type :classes end |
Instance Method Details
#associations_from_yaml(model, values) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/lutaml/lml/models/uml_class.rb', line 57 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
50 51 52 53 54 55 |
# File 'lib/lutaml/lml/models/uml_class.rb', line 50 def associations_to_yaml(model, doc) return unless model.associations associations = model.associations.map(&:to_hash) doc["associations"] = associations unless associations.empty? end |
#definition_from_yaml(model, value) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/lutaml/lml/models/uml_class.rb', line 70 def definition_from_yaml(model, value) model.definition = value.to_s .gsub(/\\}/, "}") .gsub(/\\{/, "{") .split("\n") .map(&:strip) .join("\n") end |
#definition_to_yaml(model, doc) ⇒ Object
66 67 68 |
# File 'lib/lutaml/lml/models/uml_class.rb', line 66 def definition_to_yaml(model, doc) doc["definition"] = model.definition if model.definition end |