class Shale::Mapping::Xml
Attributes
Return attributes mapping hash
@return [Hash]
@api private
Return content mapping
@return [Symbol]
@api private
Return elements mapping hash
@return [Hash]
@api private
Public Class Methods
Initialize instance
@api private
# File lib/shale/mapping/xml.rb, line 32 def initialize super @elements = {} @attributes = {} @content = nil @root = '' end
Public Instance Methods
@api private
# File lib/shale/mapping/xml.rb, line 87 def initialize_dup(other) @elements = other.instance_variable_get('@elements').dup @attributes = other.instance_variable_get('@attributes').dup @content = other.instance_variable_get('@content').dup @root = other.instance_variable_get('@root').dup super end
Map document’s attribute to object’s attribute
@param [String] attribute Document’s attribute @param [Symbol] to Object’s attribute
@raise [IncorrectMappingArgumentsError] when arguments are incorrect
@api private
# File lib/shale/mapping/xml.rb, line 61 def map_attribute(attribute, to: nil, using: nil) validate_arguments(attribute, to, using) @attributes[attribute] = to || using end
Map document’s content to object’s attribute
@param [Symbol] to Object’s attribute
@api private
# File lib/shale/mapping/xml.rb, line 71 def map_content(to:) @content = to end
Map element to attribute
@param [String] element Document’s element @param [Symbol] to Object’s attribute
@raise [IncorrectMappingArgumentsError] when arguments are incorrect
@api private
# File lib/shale/mapping/xml.rb, line 48 def map_element(element, to: nil, using: nil) validate_arguments(element, to, using) @elements[element] = to || using end
Name document’s element
@param [String, nil] value Document’s element name
@return [Stirng, nil]
@api private
# File lib/shale/mapping/xml.rb, line 82 def root(value = nil) value.nil? ? @root : @root = value end