Class: Shale::Mapping::Group::Xml Private

Inherits:
Dict show all
Defined in:
lib/shale/mapping/group/xml.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Xml group descriptor

Instance Attribute Summary

Attributes inherited from DictBase

#keys, #root

Instance Method Summary collapse

Methods inherited from Dict

#group, #map, #render_nil

Methods inherited from DictBase

#finalize!, #finalized?, #initialize_dup, #map, #properties

Constructor Details

#initialize(method_from, method_to) ⇒ Xml

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize instance

Parameters:

  • method_from (Symbol)
  • method_to (Symbol)


18
19
20
21
# File 'lib/shale/mapping/group/xml.rb', line 18

def initialize(method_from, method_to)
  super(method_from, method_to)
  @dict = { content: nil, attributes: {}, elements: {} }
end

Instance Method Details

#add(kind, key, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add key-value pair to a group

Parameters:

  • kind (Symbol)
  • key (String)
  • value (any)


30
31
32
33
34
35
36
37
38
39
# File 'lib/shale/mapping/group/xml.rb', line 30

def add(kind, key, value)
  case kind
  when :content
    @dict[:content] = value
  when :attribute
    @dict[:attributes][key] = value
  when :element
    @dict[:elements][key] = value
  end
end