class Fog::Parsers::XenServer::Base

Attributes

response[R]

Public Class Methods

new() click to toggle source
# File lib/fog/parsers/xen_server/base.rb, line 7
def initialize
  reset
end

Public Instance Methods

parse( data ) click to toggle source
# File lib/fog/parsers/xen_server/base.rb, line 15
def parse( data )
  if data.kind_of? Hash
    @response = data.symbolize_keys!
    @response.each do |k,v|
      if @response[k] == "OpaqueRef:NULL"
        @response[k] = nil
      end
    end
  elsif data.kind_of? Array
    @response = data.first
  elsif data.kind_of?(String) and data =~ /OpaqueRef:/
    @response = data
  end

  @response
end
reset() click to toggle source
# File lib/fog/parsers/xen_server/base.rb, line 11
def reset
  @response = {}
end