Class: Shale::Mapping::XmlGroup Private
- 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
-
#name ⇒ String
readonly
private
Return name of the group.
Attributes inherited from XmlBase
#attributes, #content, #default_namespace, #elements
Instance Method Summary collapse
-
#initialize(from, to) ⇒ XmlGroup
constructor
private
Initialize instance.
-
#map_attribute(attribute, namespace: nil, prefix: nil) ⇒ Object
private
Map document’s attribute to object’s attribute.
-
#map_content ⇒ Object
private
Map document’s content to object’s attribute.
-
#map_element(element, namespace: :undefined, prefix: :undefined) ⇒ Object
private
Map element to attribute.
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
#name ⇒ String (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
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
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_content ⇒ 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 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
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 |