Parent

Methods

Class/Module Index [+]

Quicksearch

Gyoku::Array

Public Class Methods

to_xml(array, key, escape_xml = true, attributes = {}, options = {}) click to toggle source

Translates a given array to XML. Accepts the XML key to add the elements to, whether to escape_xml and an optional Hash of attributes.

# File lib/gyoku/array.rb, line 11
def self.to_xml(array, key, escape_xml = true, attributes = {}, options = {})
  iterate_with_xml array, attributes do |xml, item, attrs, index|
    case item
      when ::Hash   then xml.tag!(key, attrs) { xml << Hash.to_xml(item, options) }
      when NilClass then xml.tag!(key, "xsi:nil" => "true")
      else               xml.tag!(key, attrs) { xml << XMLValue.create(item, escape_xml) }
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.