DataMapper::Serializer::ValidationErrors::ToXml

Public Instance Methods

to_xml(opts = {}) click to toggle source
    # File lib/dm-serializer/to_xml.rb, line 67
67:         def to_xml(opts = {})
68:           to_xml_document(opts).to_s
69:         end
to_xml_document(opts = {}) click to toggle source
    # File lib/dm-serializer/to_xml.rb, line 71
71:         def to_xml_document(opts = {})
72:           xml = DataMapper::Serializer::XML.serializer
73:           doc = xml.new_document
74:           root = xml.root_node(doc, "errors", {'type' => 'hash'})
75: 
76:           errors.each do |key, value|
77:             property = xml.add_node(root, key.to_s, nil, {'type' => 'array'})
78:             property.attributes["type"] = 'array'
79: 
80:             value.each do |error|
81:               xml.add_node(property, "error", error)
82:             end
83:           end
84: 
85:           doc
86:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.