activesupport 3.0.8.rc2 → 3.0.8.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/xml_mini/jdom.rb +10 -3
- metadata +4 -4
@@ -41,7 +41,7 @@ module ActiveSupport
|
|
41
41
|
xml_string_reader = StringReader.new(data)
|
42
42
|
xml_input_source = InputSource.new(xml_string_reader)
|
43
43
|
doc = @dbf.new_document_builder.parse(xml_input_source)
|
44
|
-
merge_element!({}, doc.document_element)
|
44
|
+
merge_element!({CONTENT_KEY => ''}, doc.document_element)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -54,9 +54,14 @@ module ActiveSupport
|
|
54
54
|
# element::
|
55
55
|
# XML element to merge into hash
|
56
56
|
def merge_element!(hash, element)
|
57
|
+
delete_empty(hash)
|
57
58
|
merge!(hash, element.tag_name, collapse(element))
|
58
59
|
end
|
59
60
|
|
61
|
+
def delete_empty(hash)
|
62
|
+
hash.delete(CONTENT_KEY) if hash[CONTENT_KEY] == ''
|
63
|
+
end
|
64
|
+
|
60
65
|
# Actually converts an XML document element into a data structure.
|
61
66
|
#
|
62
67
|
# element::
|
@@ -84,6 +89,7 @@ module ActiveSupport
|
|
84
89
|
# element::
|
85
90
|
# XML element whose texts are to me merged into the hash
|
86
91
|
def merge_texts!(hash, element)
|
92
|
+
delete_empty(hash)
|
87
93
|
text_children = texts(element)
|
88
94
|
if text_children.join.empty?
|
89
95
|
hash
|
@@ -128,8 +134,9 @@ module ActiveSupport
|
|
128
134
|
attribute_hash = {}
|
129
135
|
attributes = element.attributes
|
130
136
|
for i in 0...attributes.length
|
131
|
-
|
132
|
-
|
137
|
+
attribute_hash[CONTENT_KEY] ||= ''
|
138
|
+
attribute_hash[attributes.item(i).name] = attributes.item(i).value
|
139
|
+
end
|
133
140
|
attribute_hash
|
134
141
|
end
|
135
142
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424061
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 8
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 3.0.8.
|
11
|
+
- 4
|
12
|
+
version: 3.0.8.rc4
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- David Heinemeier Hansson
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-31 00:00:00 Z
|
21
21
|
dependencies: []
|
22
22
|
|
23
23
|
description: A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Rich support for multibyte strings, internationalization, time zones, and testing.
|