DataMapper::Serializer::XML::LibXML

Public Class Methods

add_node(parent, name, value, attrs = {}) click to toggle source
    # File lib/dm-serializer/xml/libxml.rb, line 22
22:         def self.add_node(parent, name, value, attrs = {})
23:           value_str = value.to_s unless value.nil?
24:           node = ::LibXML::XML::Node.new(name, value_str)
25: 
26:           attrs.each do |attr_name, attr_val|
27:             node[attr_name] = attr_val
28:           end
29: 
30:           parent << node
31:           node
32:         end
add_xml(parent, xml) click to toggle source
    # File lib/dm-serializer/xml/libxml.rb, line 34
34:         def self.add_xml(parent, xml)
35:           parent << xml.root.copy(true)
36:         end
new_document() click to toggle source
   # File lib/dm-serializer/xml/libxml.rb, line 7
7:         def self.new_document
8:           ::LibXML::XML::Document.new
9:         end
output(doc) click to toggle source
    # File lib/dm-serializer/xml/libxml.rb, line 38
38:         def self.output(doc)
39:           doc.root.to_s
40:         end
root_node(doc, name, attrs = {}) click to toggle source
    # File lib/dm-serializer/xml/libxml.rb, line 11
11:         def self.root_node(doc, name, attrs = {})
12:           root = ::LibXML::XML::Node.new(name)
13: 
14:           attrs.each do |attr_name, attr_val|
15:             root[attr_name] = attr_val
16:           end
17: 
18:           doc.root.nil? ? doc.root = root : doc.root << root
19:           root
20:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.