1
0
Fork 0
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:
geemus 2010-06-18 15:16:07 -07:00
parent 3ea7770421
commit c481561af3

View file

@ -26,7 +26,7 @@ module Fog
end
module Fog
class ToHashParser
class ToHashDocument < Nokogiri::XML::SAX::Document
def initialize
@stack = []
@ -41,7 +41,7 @@ module Fog
last = @stack.pop
if last.empty? && @value.empty?
@stack.last[name.to_sym] = ''
elsif @value.empty?
elsif !@value.empty?
@stack.last[name.to_sym] = @value
end
@value = ''
@ -60,7 +60,7 @@ module Fog
else
key, value = attributes.shift, attributes.shift
end
parsed_attributes[key.to_sym.gsub(':','_')] = value
parsed_attributes[key.gsub(':','_').to_sym] = value
end
if @stack.last.is_a?(Array)
@stack.last << {name.to_sym => parsed_attributes}