lib/gyoku/xml_value.rb in gyoku-1.3.0 vs lib/gyoku/xml_value.rb in gyoku-1.3.1
- old
+ new
@@ -13,11 +13,11 @@
# xs:dateTime format
XS_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S%Z"
# Converts a given +object+ to an XML value.
- def create(object, escape_xml = true)
+ def create(object, escape_xml = true, options = {})
if Time === object
object.strftime XS_TIME_FORMAT
elsif DateTime === object
object.strftime XS_DATETIME_FORMAT
elsif Date === object
@@ -26,9 +26,11 @@
escape_xml ? CGI.escapeHTML(object) : object
elsif object.respond_to?(:to_datetime)
create object.to_datetime
elsif object.respond_to?(:call)
create object.call
+ elsif ::Hash === object
+ Gyoku::Hash.to_xml(object, options)
else
object.to_s
end
end