Module: Lutaml::HashFormat::Type::Serializers

Defined in:
lib/lutaml/hash_format/type/serializers.rb

Overview

Registers Hash-format-specific type serializers for types that need custom to_hash / from_hash behavior beyond the default.

Class Method Summary collapse

Class Method Details

.register_all!Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/lutaml/hash_format/type/serializers.rb', line 11

def register_all!
  v = Lutaml::Model::Type::Value

  # Reference — key for to_hash, cast for from_hash
  v.register_format_type_serializer(
    :hash, Lutaml::Model::Type::Reference,
    to: lambda(&:key),
    from: ->(val) { Lutaml::Model::Type::Reference.cast(val) }
  )
end