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

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

Instance Attribute Summary

Attributes inherited from KeyValue::Mapping

#format, #key_mapping, #register_mappings, #value_mapping

Attributes inherited from Model::Mapping

#mappings

Instance Method Summary collapse

Methods inherited from KeyValue::Mapping

#deep_dup, #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, #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, #deep_dup, #duplicate_mappings, #ensure_mappings_imported!, #inherit_from, #listeners_for, #omit_element, #omit_listener, #parent_mapping

Methods included from Model::DeepDupable

#deep_dup

Constructor Details

#initializeMapping

Returns a new instance of Mapping.



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

def initialize
  super(:toml)
end

Instance Method Details

#dup_instanceObject



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

def dup_instance
  self.class.new
end

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



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

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