smacks-apricoteatsgorilla 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/apricoteatsgorilla.rb +7 -1
- metadata +1 -1
data/lib/apricoteatsgorilla.rb
CHANGED
@@ -58,7 +58,7 @@ class ApricotEatsGorilla
|
|
58
58
|
def tag(name, attributes = {})
|
59
59
|
return "<#{name} />" unless block_given?
|
60
60
|
|
61
|
-
attr = opt_order(attributes).map { |k, v|
|
61
|
+
attr = opt_order(attributes).map { |k, v| %Q( xmlns:#{k}="#{v}") }.to_s
|
62
62
|
body = (yield && !yield.empty?) ? yield : ""
|
63
63
|
"<#{name}#{attr}>" << body << "</#{name}>"
|
64
64
|
end
|
@@ -78,6 +78,7 @@ class ApricotEatsGorilla
|
|
78
78
|
key, value = child.name, xml_node_to_hash(child)
|
79
79
|
end
|
80
80
|
|
81
|
+
key = remove_namespace(key)
|
81
82
|
current = this_node[key]
|
82
83
|
case current
|
83
84
|
when Array
|
@@ -129,6 +130,11 @@ class ApricotEatsGorilla
|
|
129
130
|
xml = xml.gsub(/(>)\s*(<)/, '\1\2')
|
130
131
|
end
|
131
132
|
|
133
|
+
# Helper to remove namespaces from XML tags.
|
134
|
+
def remove_namespace(tag)
|
135
|
+
tag.sub(/.+:(.+)/, '\1')
|
136
|
+
end
|
137
|
+
|
132
138
|
# Helper to convert "true" and "false" strings to boolean values.
|
133
139
|
# Returns the original string in case it doesn't match "true" or "false".
|
134
140
|
def booleanize(string)
|