Class: TerremarkParser

Inherits:
Fog::Parsers::Base show all
Defined in:
lib/fog/terremark/parser.rb

Instance Attribute Summary

Attributes inherited from Fog::Parsers::Base

#response

Instance Method Summary collapse

Methods inherited from Fog::Parsers::Base

#attr_value, #characters, #end_element_namespace, #initialize, #reset, #start_element, #start_element_namespace, #value

Constructor Details

This class inherits a constructor from Fog::Parsers::Base

Instance Method Details

#extract_attributes(attributes_xml) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/terremark/parser.rb', line 4

def extract_attributes(attributes_xml)
  attributes = {}
  until attributes_xml.empty?
    if attributes_xml.first.is_a?(Array)
      until attributes_xml.first.empty?
        attribute = attributes_xml.first.shift
        attributes[attribute.localname] = attribute.value
      end
    else
      attribute = attributes_xml.shift
      attributes[attribute.localname] = attribute.value
    end
  end
  attributes
end