Class: Lutaml::Model::KeyValueMappingRule

Inherits:
MappingRule
  • Object
show all
Defined in:
lib/lutaml/model/key_value_mapping_rule.rb

Instance Attribute Summary collapse

Attributes inherited from MappingRule

#attribute, #custom_methods, #delegate, #name, #render_default, #render_nil, #to

Instance Method Summary collapse

Methods inherited from MappingRule

#deserialize, #multiple_mappings?, #serialize, #serialize_attribute, #to_value_for, #using_custom_methods?

Constructor Details

#initialize(name, to:, render_nil: false, render_default: false, with: {}, delegate: nil, child_mappings: nil, id: nil) ⇒ KeyValueMappingRule

Returns a new instance of KeyValueMappingRule.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lutaml/model/key_value_mapping_rule.rb', line 8

def initialize(
  name,
  to:,
  render_nil: false,
  render_default: false,
  with: {},
  delegate: nil,
  child_mappings: nil,
  id: nil
)
  super(
    name,
    to: to,
    render_nil: render_nil,
    render_default: render_default,
    with: with,
    delegate: delegate,
    id: id
  )

  @child_mappings = child_mappings
end

Instance Attribute Details

#child_mappingsObject (readonly)

Returns the value of attribute child_mappings.



6
7
8
# File 'lib/lutaml/model/key_value_mapping_rule.rb', line 6

def child_mappings
  @child_mappings
end

Instance Method Details

#deep_dupObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/lutaml/model/key_value_mapping_rule.rb', line 31

def deep_dup
  self.class.new(
    name.dup,
    to: to.dup,
    render_nil: render_nil.dup,
    with: Utils.deep_dup(custom_methods),
    delegate: delegate,
    child_mappings: Utils.deep_dup(child_mappings),
  )
end