DataMapper::Serializer::XML::Nokogiri

Public Class Methods

add_node(parent, name, value, attrs = {}) click to toggle source
    # File lib/dm-serializer/xml/nokogiri.rb, line 22
22:         def self.add_node(parent, name, value, attrs = {})
23:           node = ::Nokogiri::XML::Node.new(name, parent.document)
24:           node << ::Nokogiri::XML::Text.new(value.to_s, parent.document) unless value.nil?
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/nokogiri.rb, line 34
34:         def self.add_xml(parent, xml)
35:           parent << xml.root
36:         end
new_document() click to toggle source
   # File lib/dm-serializer/xml/nokogiri.rb, line 7
7:         def self.new_document
8:           ::Nokogiri::XML::Document.new
9:         end
output(doc) click to toggle source
    # File lib/dm-serializer/xml/nokogiri.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/nokogiri.rb, line 11
11:         def self.root_node(doc, name, attrs = {})
12:           root = ::Nokogiri::XML::Node.new(name, doc)
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.