xommelier 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
data/lib/xommelier/version.rb
CHANGED
@@ -60,7 +60,8 @@ module Xommelier
|
|
60
60
|
|
61
61
|
def to_xml(options = {})
|
62
62
|
options = SERIALIZATION_OPTIONS.merge(options)
|
63
|
-
element_name = options.delete(:element_name) { self.element_name }
|
63
|
+
element_name = options.delete(:element_name) { self.element_name }
|
64
|
+
element_name = element_name.to_s
|
64
65
|
element_name << '_' if %w(text class id).include?(element_name)
|
65
66
|
if options[:builder] # Non-root element
|
66
67
|
builder = options.delete(:builder)
|
@@ -196,7 +197,9 @@ module Xommelier
|
|
196
197
|
when Xommelier::Xml::Element
|
197
198
|
value.to_xommelier(builder: xml, element_name: options[:element_name])
|
198
199
|
else
|
199
|
-
|
200
|
+
element_name = options[:element_name].to_s
|
201
|
+
element_name << '_' if %w(text class id).include?(element_name)
|
202
|
+
(prefix ? xml[prefix] : xml).send(element_name) { xml.text(value.to_xommelier) }
|
200
203
|
end
|
201
204
|
end
|
202
205
|
end
|
data/spec/lib/xommelier_spec.rb
CHANGED