Class: Lutaml::XMI::Parsers::XML
- Inherits:
-
Object
- Object
- Lutaml::XMI::Parsers::XML
- Includes:
- XMIBase
- Defined in:
- lib/lutaml/xmi/parsers/xml.rb
Overview
Class for parsing .xmi schema files into ::Lutaml::Uml::Document
Instance Attribute Summary collapse
-
#xmi_cache ⇒ Object
readonly
Returns the value of attribute xmi_cache.
-
#xmi_root_model ⇒ Object
readonly
Returns the value of attribute xmi_root_model.
Class Method Summary collapse
- .parse(xml, _options = {}) ⇒ Lutaml::Uml::Document
- .serialize_generalization_by_name(xml, name, guidance = nil) ⇒ Hash
- .serialize_xmi(xml, with_gen: false) ⇒ Hash
- .serialize_xmi_to_liquid(xml, guidance = nil) ⇒ Liquid::Drop
Instance Method Summary collapse
- #parse(xmi_model) ⇒ Lutaml::Uml::Document
- #serialize_generalization_by_name(xmi_model, name, guidance_yaml = nil) ⇒ Hash
-
#serialize_xmi(xmi_model, with_gen: false, with_absolute_path: false) ⇒ Object
return [Hash].
-
#serialize_xmi_to_liquid(xmi_model, guidance_yaml = nil) ⇒ Object
return [Liquid::Drop].
Methods included from XMIBase
#get_guidance, included, #set_xmi_model
Instance Attribute Details
#xmi_cache ⇒ Object (readonly)
Returns the value of attribute xmi_cache.
14 15 16 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 14 def xmi_cache @xmi_cache end |
#xmi_root_model ⇒ Object (readonly)
Returns the value of attribute xmi_root_model.
14 15 16 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 14 def xmi_root_model @xmi_root_model end |
Class Method Details
.parse(xml, _options = {}) ⇒ Lutaml::Uml::Document
22 23 24 25 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 22 def parse(xml, = {}) xmi_model = get_xmi_model(xml) new.parse(xmi_model) end |
.serialize_generalization_by_name(xml, name, guidance = nil) ⇒ Hash
46 47 48 49 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 46 def serialize_generalization_by_name(xml, name, guidance = nil) xmi_model = get_xmi_model(xml) new.serialize_generalization_by_name(xmi_model, name, guidance) end |
.serialize_xmi(xml, with_gen: false) ⇒ Hash
30 31 32 33 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 30 def serialize_xmi(xml, with_gen: false) xmi_model = get_xmi_model(xml) new.serialize_xmi(xmi_model, with_gen: with_gen) end |
.serialize_xmi_to_liquid(xml, guidance = nil) ⇒ Liquid::Drop
37 38 39 40 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 37 def serialize_xmi_to_liquid(xml, guidance = nil) xmi_model = get_xmi_model(xml) new.serialize_xmi_to_liquid(xmi_model, guidance) end |
Instance Method Details
#parse(xmi_model) ⇒ Lutaml::Uml::Document
54 55 56 57 58 59 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 54 def parse(xmi_model) set_xmi_model(xmi_model) serialized_hash = serialize_xmi(xmi_model) ::Lutaml::Uml::Document.new(serialized_hash) end |
#serialize_generalization_by_name(xmi_model, name, guidance_yaml = nil) ⇒ Hash
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 94 def serialize_generalization_by_name(xmi_model, name, # rubocop:disable Metrics/MethodLength guidance_yaml = nil) set_xmi_model(xmi_model) klass = find_klass_packaged_element(name) guidance = get_guidance(guidance_yaml) = { xmi_root_model: @xmi_root_model, xmi_cache: @xmi_cache, with_gen: true, with_absolute_path: true, } ::Lutaml::XMI::KlassDrop.new( klass, guidance, , ) end |
#serialize_xmi(xmi_model, with_gen: false, with_absolute_path: false) ⇒ Object
return [Hash]
65 66 67 68 69 70 71 72 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 65 def serialize_xmi(xmi_model, with_gen: false, with_absolute_path: false) set_xmi_model(xmi_model) serialize_to_hash( xmi_model, with_gen: with_gen, with_absolute_path: with_absolute_path, ) end |
#serialize_xmi_to_liquid(xmi_model, guidance_yaml = nil) ⇒ Object
return [Liquid::Drop]
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/lutaml/xmi/parsers/xml.rb', line 77 def serialize_xmi_to_liquid(xmi_model, guidance_yaml = nil) set_xmi_model(xmi_model) model = xmi_model.model = { xmi_root_model: @xmi_root_model, xmi_cache: @xmi_cache, with_gen: true, with_absolute_path: true, } guidance = get_guidance(guidance_yaml) ::Lutaml::XMI::RootDrop.new(model, guidance, ) end |