xmlhash 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/lib/xmlhash.rb +2 -2
- data/test/test_xmlhash.rb +6 -0
- metadata +1 -1
data/History.txt
CHANGED
data/lib/xmlhash.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'xmlhash/xmlhash'
|
2
2
|
|
3
3
|
module Xmlhash
|
4
|
-
VERSION = '1.3.
|
4
|
+
VERSION = '1.3.3'
|
5
5
|
|
6
6
|
class XMLHash < Hash
|
7
7
|
|
@@ -18,7 +18,7 @@ module Xmlhash
|
|
18
18
|
raise ArgumentError, "expected string"
|
19
19
|
end
|
20
20
|
sub = self[name]
|
21
|
-
return []
|
21
|
+
return [] if !sub || sub.empty?
|
22
22
|
unless sub.kind_of? Array
|
23
23
|
if block_given?
|
24
24
|
yield sub
|
data/test/test_xmlhash.rb
CHANGED
@@ -118,4 +118,10 @@ eos
|
|
118
118
|
ret = Xmlhash.parse(xml)
|
119
119
|
assert_equal ret['diff'], {"lines" => "1", "_content" => "DummyContent" }
|
120
120
|
end
|
121
|
+
|
122
|
+
def test_empty
|
123
|
+
xml = "<request><files/></request>"
|
124
|
+
ret = Xmlhash.parse(xml)
|
125
|
+
assert_equal ret.elements('files'), []
|
126
|
+
end
|
121
127
|
end
|