Class: Lutaml::Model::TransformationBuilder Abstract
- Inherits:
-
Object
- Object
- Lutaml::Model::TransformationBuilder
- Defined in:
- lib/lutaml/model/transformation_builder.rb
Overview
Subclasses must implement TransformationBuilder.build
Abstract base class for transformation builders.
Implements the Builder Pattern for creating format-specific transformations. This satisfies the Open/Closed Principle: open for extension, closed for modification.
To add a new serialization format:
-
Create a subclass of TransformationBuilder
-
Implement the ‘build` class method
-
Register with TransformationRegistry.register_builder(format, builder)
Direct Known Subclasses
Class Method Summary collapse
-
.build(model_class, mapping, format, register) ⇒ Transformation
abstract
Build a transformation instance for the given format.
-
.handles?(format) ⇒ Boolean
Check if this builder can handle the given format.
Class Method Details
.build(model_class, mapping, format, register) ⇒ Transformation
Subclasses must implement this method
Build a transformation instance for the given format.
36 37 38 39 |
# File 'lib/lutaml/model/transformation_builder.rb', line 36 def self.build(model_class, mapping, format, register) raise NotImplementedError, "#{self.class}.build must be implemented" end |
.handles?(format) ⇒ Boolean
Check if this builder can handle the given format.
Default implementation checks the FORMATS constant. Subclasses can override for more complex logic.
48 49 50 51 52 |
# File 'lib/lutaml/model/transformation_builder.rb', line 48 def self.handles?(format) return false unless const_defined?(:FORMATS, false) const_get(:FORMATS, false).include?(format) end |