class Shale::Mapping::Xml

Attributes

attributes[R]

Return attributes mapping hash

@return [Hash]

@api private

content[R]

Return content mapping

@return [Symbol]

@api private

elements[R]

Return elements mapping hash

@return [Hash]

@api private

Public Class Methods

new() click to toggle source

Initialize instance

@api private

Calls superclass method
# File lib/shale/mapping/xml.rb, line 32
def initialize
  super
  @elements = {}
  @attributes = {}
  @content = nil
  @root = ''
end

Public Instance Methods

initialize_dup(other) click to toggle source

@api private

Calls superclass method
# 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_attribute(attribute, to: nil, using: nil) click to toggle source

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_content(to:) click to toggle source

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(element, to: nil, using: nil) click to toggle source

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
root(value = nil) click to toggle source

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