Sha256: d1d18eedcf2a19dbe5e0abc0648201b94e99b27cce5fce54b105ded962b5fe45

Contents?: true

Size: 595 Bytes

Versions: 3

Compression:

Stored size: 595 Bytes

Contents

module DataMapper
  module Serialize
    module XMLSerializers
      module REXML
        def self.new_document
          ::REXML::Document.new
        end

        def self.root_node(document, name, attrs = {})
          add_node(document.root || document, name, nil, attrs)
        end

        def self.add_node(parent, name, value, attrs = {})
          node = parent.add_element(name)
          attrs.each {|attr_name, attr_val| node.attributes[attr_name] = attr_val}
          node << ::REXML::Text.new(value.to_s) unless value.nil?
          node
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dm-serializer-0.9.9 lib/dm-serializer/xml_serializers/rexml.rb
mack-data_mapper-0.8.3 lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers/rexml.rb
mack-data_mapper-0.8.3.1 lib/gems/dm-serializer-0.9.9/lib/dm-serializer/xml_serializers/rexml.rb