Class: Shale::Mapping::XmlGroup Private

Inherits:
XmlBase
  • Object
show all
Defined in:
lib/shale/mapping/xml_group.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.

Group for XML serialization format

Instance Attribute Summary collapse

Attributes inherited from XmlBase

#attributes, #content, #default_namespace, #elements

Instance Method Summary collapse

Methods inherited from XmlBase

#finalize!, #finalized?, #initialize_dup, #namespace, #prefixed_root, #root, #unprefixed_root

Constructor Details

#initialize(from, to) ⇒ XmlGroup

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



21
22
23
24
25
26
# File 'lib/shale/mapping/xml_group.rb', line 21

def initialize(from, to)
  super()
  @from = from
  @to = to
  @name = "group_#{hash}"
end

Instance Attribute Details

#nameString (readonly)

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.

Return name of the group

Returns:

  • (String)


16
17
18
# File 'lib/shale/mapping/xml_group.rb', line 16

def name
  @name
end

Instance Method Details

#map_attribute(attribute, namespace: nil, prefix: nil) ⇒ 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.

Map document’s attribute to object’s attribute

Parameters:

  • attribute (String)
  • namespace (String, nil) (defaults to: nil)
  • prefix (String, nil) (defaults to: nil)


52
53
54
55
56
57
58
59
60
# File 'lib/shale/mapping/xml_group.rb', line 52

def map_attribute(attribute, namespace: nil, prefix: nil)
  super(
    attribute,
    using: { from: @from, to: @to },
    group: @name,
    namespace: namespace,
    prefix: prefix
  )
end

#map_contentObject

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.

Map document’s content to object’s attribute



65
66
67
# File 'lib/shale/mapping/xml_group.rb', line 65

def map_content
  super(using: { from: @from, to: @to }, group: @name)
end

#map_element(element, namespace: :undefined, prefix: :undefined) ⇒ 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.

Map element to attribute

Parameters:

  • element (String)
  • namespace (String, nil) (defaults to: :undefined)
  • prefix (String, nil) (defaults to: :undefined)


35
36
37
38
39
40
41
42
43
# File 'lib/shale/mapping/xml_group.rb', line 35

def map_element(element, namespace: :undefined, prefix: :undefined)
  super(
    element,
    using: { from: @from, to: @to },
    group: @name,
    namespace: namespace,
    prefix: prefix
  )
end