1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/compute/parsers/voxel/images_list.rb

41 lines
822 B
Ruby
Raw Normal View History

2011-02-20 22:01:28 -05:00
module Fog
module Parsers
module Voxel
module Compute
class ImagesList < Fog::Parsers::Base
def reset
@image = {}
@response = { :stat => nil, :images => [] }
end
def start_element(name, attrs = [])
super
case name
when 'image'
@image = {
:id => attr_value('id', attrs).to_i,
:name => attr_value('summary', attrs)
}
when 'rsp'
@response[:stat] = attr_value('stat', attrs)
end
end
def end_element(name)
case name
when 'image'
@response[:images] << @image
@image = {}
end
end
end
end
end
end
end