Module: Lutaml::ModelTransformations
- Defined in:
- lib/lutaml/model_transformations.rb,
lib/lutaml/model_transformations/configuration.rb,
lib/lutaml/model_transformations/format_registry.rb,
lib/lutaml/model_transformations/parsers/qea_parser.rb,
lib/lutaml/model_transformations/parsers/xmi_parser.rb,
lib/lutaml/model_transformations/parsers/base_parser.rb,
lib/lutaml/model_transformations/transformation_engine.rb
Overview
Model Transformations module provides a unified, extensible system for transforming various UML model formats (XMI, QEA, etc.) into a common UML document representation.
This module follows SOLID principles and implements:
-
Single Responsibility: Each component has one clear purpose
-
Open/Closed: Easy to extend with new formats without modifying existing
code
-
Liskov Substitution: All parsers implement the same interface
-
Interface Segregation: Clients depend only on methods they use
-
Dependency Inversion: Depends on abstractions, not concrete
implementations
Defined Under Namespace
Modules: Parsers Classes: Configuration, FormatRegistry, TransformationEngine, UnsupportedFormatError
Class Method Summary collapse
-
.configuration ⇒ Configuration
Get current configuration.
-
.configuration=(config) ⇒ Object
Set configuration.
-
.configure {|config| ... } ⇒ Object
Configure using a block.
-
.detect_parser(file_path) ⇒ Class
Auto-detect file format and return appropriate parser.
-
.engine ⇒ TransformationEngine
Get the default transformation engine.
-
.engine=(engine) ⇒ Object
Set a custom transformation engine.
-
.load_configuration(config_path) ⇒ Configuration
Load configuration from file.
-
.parse(file_path, options = {}) ⇒ Lutaml::Uml::Document
Parse a model file using the default engine.
-
.register_parser(extension, parser_class) ⇒ Object
Register a custom parser for a file extension.
-
.reset_statistics ⇒ Object
Reset transformation statistics.
-
.statistics ⇒ Hash
Get transformation statistics.
-
.supported_extensions ⇒ Array<String>
Get list of supported file extensions.
-
.supports_file?(file_path) ⇒ Boolean
Check if a file is supported.
-
.validate_setup ⇒ Object
Validate setup of the transformation engine.
Class Method Details
.configuration ⇒ Configuration
Get current configuration
125 126 127 |
# File 'lib/lutaml/model_transformations.rb', line 125 def configuration engine.configuration end |
.configuration=(config) ⇒ Object
Set configuration
132 133 134 |
# File 'lib/lutaml/model_transformations.rb', line 132 def configuration=(config) engine.configuration = config end |
.configure {|config| ... } ⇒ Object
Configure using a block
138 139 140 |
# File 'lib/lutaml/model_transformations.rb', line 138 def configure yield(configuration) if block_given? end |
.detect_parser(file_path) ⇒ Class
Auto-detect file format and return appropriate parser
70 71 72 |
# File 'lib/lutaml/model_transformations.rb', line 70 def detect_parser(file_path) engine.detect_parser(file_path) end |
.engine ⇒ TransformationEngine
Get the default transformation engine
46 47 48 |
# File 'lib/lutaml/model_transformations.rb', line 46 def engine @engine ||= TransformationEngine.new end |
.engine=(engine) ⇒ Object
Set a custom transformation engine
53 54 55 |
# File 'lib/lutaml/model_transformations.rb', line 53 def engine=(engine) @engine = engine end |
.load_configuration(config_path) ⇒ Configuration
Load configuration from file
118 119 120 |
# File 'lib/lutaml/model_transformations.rb', line 118 def load_configuration(config_path) engine.configuration = Configuration.load(config_path) end |
.parse(file_path, options = {}) ⇒ Lutaml::Uml::Document
Parse a model file using the default engine
62 63 64 |
# File 'lib/lutaml/model_transformations.rb', line 62 def parse(file_path, = {}) engine.parse(file_path, ) end |
.register_parser(extension, parser_class) ⇒ Object
Register a custom parser for a file extension
interface
110 111 112 |
# File 'lib/lutaml/model_transformations.rb', line 110 def register_parser(extension, parser_class) engine.register_parser(extension, parser_class) end |
.reset_statistics ⇒ Object
Reset transformation statistics
96 97 98 |
# File 'lib/lutaml/model_transformations.rb', line 96 def reset_statistics engine.clear_history end |
.statistics ⇒ Hash
Get transformation statistics
91 92 93 |
# File 'lib/lutaml/model_transformations.rb', line 91 def statistics engine.statistics end |
.supported_extensions ⇒ Array<String>
Get list of supported file extensions
77 78 79 |
# File 'lib/lutaml/model_transformations.rb', line 77 def supported_extensions engine.supported_extensions end |
.supports_file?(file_path) ⇒ Boolean
Check if a file is supported
84 85 86 |
# File 'lib/lutaml/model_transformations.rb', line 84 def supports_file?(file_path) engine.supports_file?(file_path) end |
.validate_setup ⇒ Object
Validate setup of the transformation engine
101 102 103 |
# File 'lib/lutaml/model_transformations.rb', line 101 def validate_setup engine.validate_setup end |