Class: Lutaml::KeyValue::Adapter::Toml::Mapping

Inherits:
Mapping show all
Defined in:
lib/lutaml/key_value/adapter/toml/mapping.rb

Instance Attribute Summary

Attributes inherited from Mapping

#format, #key_mapping, #mappings, #register_mappings, #value_mapping

Instance Method Summary collapse

Methods inherited from Mapping

#duplicate_mappings, #finalize, #finalized?, #find_by_name, #find_by_to, #find_by_to!, #import_model_mappings, #instance_mapping?, #map, #map_all, #map_instances, #map_key, #map_to_instance, #map_value, #mappings_hash, #name_for_mapping, #no_root, #no_root?, #polymorphic_mapping, #root, #root_mapping, #root_name, #validate_blank_mappings!, #validate_mappings!, #validate_root_mappings!, #validate_to_and_with_arguments!, #validate_with_options!

Methods inherited from Model::Mapping

#add_listener, #all_listeners, #ensure_mappings_imported!, #inherit_from, #listeners_for, #mappings, #omit_element, #omit_listener, #parent_mapping

Constructor Details

#initializeMapping

Returns a new instance of Mapping.



6
7
8
# File 'lib/lutaml/key_value/adapter/toml/mapping.rb', line 6

def initialize
  super(:toml)
end

Instance Method Details

#deep_dupObject



10
11
12
13
14
# File 'lib/lutaml/key_value/adapter/toml/mapping.rb', line 10

def deep_dup
  self.class.new.tap do |new_mapping|
    new_mapping.mappings = duplicate_mappings
  end
end

#validate!(key, to, with, render_nil, render_empty) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/lutaml/key_value/adapter/toml/mapping.rb', line 16

def validate!(key, to, with, render_nil, render_empty)
  super

  if [true, :as_nil].include?(render_nil) || render_empty == :as_nil
    raise Lutaml::Model::IncorrectMappingArgumentsError,
          "nil values are not supported in toml format"
  end
end