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 CHANGED
@@ -1,3 +1,6 @@
1
+ === 1.3.3 / 2012-11-06
2
+ * <files/> should return [] not [{}]
3
+
1
4
  === 1.3.2 / 2012-11-06
2
5
 
3
6
  * elements that have both attributes and content, are now parsed
data/lib/xmlhash.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'xmlhash/xmlhash'
2
2
 
3
3
  module Xmlhash
4
- VERSION = '1.3.2'
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 [] unless sub
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmlhash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: