Method: DataMapper::Serializer::XML::Nokogiri.root_node
- Defined in:
- lib/dm-serializer/xml/nokogiri.rb
.root_node(doc, name, attrs = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dm-serializer/xml/nokogiri.rb', line 11 def self.root_node(doc, name, attrs = {}) root = ::Nokogiri::XML::Node.new(name, doc) attrs.each do |attr_name, attr_val| root[attr_name] = attr_val end doc.root.nil? ? doc.root = root : doc.root << root root end |