mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
more fixes to ToHashDocument, as per freeformz
This commit is contained in:
parent
3ea7770421
commit
c481561af3
1 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
module Fog
|
module Fog
|
||||||
class ToHashParser
|
class ToHashDocument < Nokogiri::XML::SAX::Document
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@stack = []
|
@stack = []
|
||||||
|
@ -41,7 +41,7 @@ module Fog
|
||||||
last = @stack.pop
|
last = @stack.pop
|
||||||
if last.empty? && @value.empty?
|
if last.empty? && @value.empty?
|
||||||
@stack.last[name.to_sym] = ''
|
@stack.last[name.to_sym] = ''
|
||||||
elsif @value.empty?
|
elsif !@value.empty?
|
||||||
@stack.last[name.to_sym] = @value
|
@stack.last[name.to_sym] = @value
|
||||||
end
|
end
|
||||||
@value = ''
|
@value = ''
|
||||||
|
@ -60,7 +60,7 @@ module Fog
|
||||||
else
|
else
|
||||||
key, value = attributes.shift, attributes.shift
|
key, value = attributes.shift, attributes.shift
|
||||||
end
|
end
|
||||||
parsed_attributes[key.to_sym.gsub(':','_')] = value
|
parsed_attributes[key.gsub(':','_').to_sym] = value
|
||||||
end
|
end
|
||||||
if @stack.last.is_a?(Array)
|
if @stack.last.is_a?(Array)
|
||||||
@stack.last << {name.to_sym => parsed_attributes}
|
@stack.last << {name.to_sym => parsed_attributes}
|
||||||
|
|
Loading…
Add table
Reference in a new issue