activesupport 3.0.8.rc2 → 3.0.8.rc4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

@@ -3,7 +3,7 @@ module ActiveSupport
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 8
6
- PRE = "rc2"
6
+ PRE = "rc4"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -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
- attribute_hash[attributes.item(i).name] = attributes.item(i).value
132
- end
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: 15424049
4
+ hash: 15424061
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 8
10
10
  - rc
11
- - 2
12
- version: 3.0.8.rc2
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-27 00:00:00 Z
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.