Class: Shale::Mapping::Xml Private
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.
Mapping for XML serialization format
Instance Attribute Summary
Attributes inherited from XmlBase
#attributes, #content, #default_namespace, #elements
Instance Method Summary collapse
-
#group(from:, to:, &block) ⇒ Object
private
Map group of nodes to mapping methods.
-
#map_attribute(attribute, to: nil, receiver: nil, using: nil, namespace: nil, prefix: nil, render_nil: nil) ⇒ Object
private
Map document’s attribute to object’s attribute.
-
#map_content(to: nil, receiver: nil, using: nil, cdata: false) ⇒ Object
private
Map document’s content to object’s attribute.
-
#map_element(element, to: nil, receiver: nil, using: nil, namespace: :undefined, prefix: :undefined, cdata: false, render_nil: nil) ⇒ Object
private
Map element to attribute.
-
#render_nil(val) ⇒ Object
private
Set render_nil default.
Methods inherited from XmlBase
#finalize!, #finalized?, #initialize, #initialize_dup, #namespace, #prefixed_root, #root, #unprefixed_root
Constructor Details
This class inherits a constructor from Shale::Mapping::XmlBase
Instance Method Details
#group(from:, to:, &block) ⇒ 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 group of nodes to mapping methods
105 106 107 108 109 110 111 112 113 114 |
# File 'lib/shale/mapping/xml.rb', line 105 def group(from:, to:, &block) group = XmlGroup.new(from, to) group.namespace(default_namespace.name, default_namespace.prefix) group.instance_eval(&block) @elements.merge!(group.elements) @attributes.merge!(group.attributes) @content = group.content if group.content end |
#map_attribute(attribute, to: nil, receiver: nil, using: nil, namespace: nil, prefix: nil, render_nil: 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
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/shale/mapping/xml.rb', line 57 def map_attribute( attribute, to: nil, receiver: nil, using: nil, namespace: nil, prefix: nil, render_nil: nil ) super( attribute, to: to, receiver: receiver, using: using, namespace: namespace, prefix: prefix, render_nil: render_nil ) end |
#map_content(to: nil, receiver: nil, using: nil, cdata: false) ⇒ 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
85 86 87 |
# File 'lib/shale/mapping/xml.rb', line 85 def map_content(to: nil, receiver: nil, using: nil, cdata: false) super(to: to, receiver: receiver, using: using, cdata: cdata) end |
#map_element(element, to: nil, receiver: nil, using: nil, namespace: :undefined, prefix: :undefined, cdata: false, render_nil: 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 element to attribute
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/shale/mapping/xml.rb', line 24 def map_element( element, to: nil, receiver: nil, using: nil, namespace: :undefined, prefix: :undefined, cdata: false, render_nil: nil ) super( element, to: to, receiver: receiver, using: using, namespace: namespace, prefix: prefix, cdata: cdata, render_nil: render_nil ) end |
#render_nil(val) ⇒ 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.
Set render_nil default
94 95 96 |
# File 'lib/shale/mapping/xml.rb', line 94 def render_nil(val) @render_nil_default = val end |