Class: Lutaml::Uml::Parsers::Yaml

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/uml/parsers/yaml.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(yaml_path, options = {}) ⇒ Object



12
13
14
# File 'lib/lutaml/uml/parsers/yaml.rb', line 12

def self.parse(yaml_path, options = {})
  new.parse(yaml_path, options)
end

Instance Method Details

#parse(yaml_path, _options = {}) ⇒ Object



16
17
18
# File 'lib/lutaml/uml/parsers/yaml.rb', line 16

def parse(yaml_path, _options = {})
  yaml_parse(yaml_path)
end

#yaml_parse(yaml_path) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/lutaml/uml/parsers/yaml.rb', line 20

def yaml_parse(yaml_path)
  yaml_content = YAML.safe_load(File.read(yaml_path))
  serialized_yaml = Lutaml::Uml::Serializers::YamlView
    .new(yaml_content)
  result = Lutaml::Uml::Document.new(serialized_yaml)
  result.classes = imports_to_classes(yaml_content, yaml_path)
  result
end