lib/gyoku/array.rb in gyoku-0.3.1 vs lib/gyoku/array.rb in gyoku-0.4.0

- old
+ new

@@ -1,23 +1,20 @@ require "builder" require "gyoku/hash" -require "gyoku/xml_key" require "gyoku/xml_value" module Gyoku class Array - extend XMLKey - extend XMLValue # 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+. def self.to_xml(array, key, escape_xml = true, attributes = {}) iterate_with_xml array, attributes do |xml, item, attrs, index| case item when ::Hash then xml.tag!(key, attrs) { xml << Hash.to_xml(item) } when NilClass then xml.tag!(key, "xsi:nil" => "true") - else xml.tag!(key, attrs) { xml << to_xml_value(item, escape_xml) } + else xml.tag!(key, attrs) { xml << XMLValue.create(item, escape_xml) } end end end private