Class: Lutaml::KeyValue::TransformationBuilder

Inherits:
Model::TransformationBuilder show all
Defined in:
lib/lutaml/key_value/transformation_builder.rb

Overview

Builder for key-value format transformations (JSON, YAML, TOML, Hash).

Creates Transformation instances for serializing models to key-value formats outputs.

Examples:

Usage

builder = TransformationBuilder
transformation = builder.build(Person, mapping, :json, register)

Constant Summary collapse

FORMATS =

Formats handled by this builder

%i[json yaml toml hash].freeze

Class Method Summary collapse

Methods inherited from Model::TransformationBuilder

handles?

Class Method Details

.build(model_class, mapping, format, register) ⇒ KeyValue::Transformation

Build a KeyValue transformation instance.

Parameters:

  • model_class (Class)

    The model class

  • mapping (KeyValue::Mapping)

    The key-value mapping

  • format (Symbol)

    The format (:json, :yaml, :toml, :hash)

  • register (Register, nil)

    The register for type resolution

Returns:



24
25
26
27
# File 'lib/lutaml/key_value/transformation_builder.rb', line 24

def self.build(model_class, mapping, format, register)
  Lutaml::KeyValue::Transformation.new(model_class, mapping, format,
                                       register)
end